I'm trying to create filter rule in service bus topic subscription.
foreach(var reciver in recivers)
{
try
{
var client = SubscriptionClient.CreateFromConnectionString(ServiceBusConnectionString, reciver.TopicName, reciver.SubscriptionName);
string ruleName = "customRule2";
client.RemoveRule(ruleName);
var filter = reciver.Reciver.GetFilter();
var ruleDescription = new RuleDescription(ruleName, filter);
client.AddRule(ruleDescription);
client.RemoveRule("$Default");
client.OnMessage((msg) => {
reciver.Reciver.Recive(msg);
});
}
catch(Exception ex)
{
}
}
Exception is getting from
client.AddRule(ruleDescription);
I tried with removing following line
client.RemoveRule(ruleName);
and it's working properly for fist time. But second time application runs, it's getting an exception "The messaging entity already exist"
But I need to remove existing rule and add the same rule when initiating the subscription.
Following is the full exception message
Microsoft.ServiceBus.Messaging.MessagingException: The service was unable to process the request; please retry the operation. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101 TrackingId:a08300d4-9f59-4455-8519-5410198ba444_G16, SystemTracker:vp-servicebus-poc:Topic:test-topic2, Timestamp:9/27/2017 9:17:35 AM ---> System.ServiceModel.FaultException
1[System.ServiceModel.ExceptionDetail]: The service was unable to process the request; please retry the operation. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101 TrackingId:a08300d4-9f59-4455-8519-5410198ba444_G16, SystemTracker:vp-servicebus-poc:Topic:test-topic2, Timestamp:9/27/2017 9:17:35 AM at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.ThrowIfFaultMessage(Message wcfMessage) at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.HandleMessageReceived(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.EndRequest(IAsyncResult result) at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory
1[System.ServiceModel.ExceptionDetail]: The service was unable to process the request; please retry the operation. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101 TrackingId:a08300d4-9f59-4455-8519-5410198ba444_G16, SystemTracker:vp-servicebus-poc:Topic:test-topic2, Timestamp:9/27/2017 9:17:35 AM at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.ThrowIfFaultMessage(Message wcfMessage) at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.HandleMessageReceived(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.EndRequest(IAsyncResult result) at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory
1[System.ServiceModel.ExceptionDetail]: The service was unable to process the request; please retry the operation. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101 TrackingId:a08300d4-9f59-4455-8519-5410198ba444_G16, SystemTracker:vp-servicebus-poc:Topic:test-topic2, Timestamp:9/27/2017 9:17:35 AM at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.ThrowIfFaultMessage(Message wcfMessage) at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.HandleMessageReceived(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.EndRequest(IAsyncResult result) at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory
1.RequestSessionChannel.RequestAsyncResult.<>c.b__9_3(RequestAsyncResult thisPtr, IAsyncResult r) at Microsoft.ServiceBus.Messaging.IteratorAsyncResult1.StepCallback(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Common.AsyncResult
1.End(IAsyncResult asyncResult) at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory1.RequestSessionChannel.EndRequest(IAsyncResult result) at Microsoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory
1.RedirectContainerSessionChannel.RequestAsyncResult.<>c__DisplayClass8_1.b__4(RequestAsyncResult thisPtr, IAsyncResult r) at Microsoft.ServiceBus.Messaging.IteratorAsyncResult1.StepCallback(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Common.AsyncResult
1.En d(IAsyncResult asyncResult) at Microsoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory1.RedirectContainerSessionChannel.EndRequest(IAsyncResult result) at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory
1.RequestSessionChannel.RequestAsyncResult.<>c.b__9_3(RequestAsyncResult thisPtr, IAsyncResult r) at Microsoft.ServiceBus.Messaging.IteratorAsyncResult1.StepCallback(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Common.AsyncResult
1.End(IAsyncResult asyncResult) at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory1.RequestSessionChannel.EndRequest(IAsyncResult result) at Microsoft.ServiceBus.Messaging.Sbmp.SbmpTransactionalAsyncResult
1.<>c.b__18_3(TIteratorAsyncResult thisPtr, IAsyncResult a) at Microsoft.ServiceBus. Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Messaging.Sbmp.SbmpSubscriptionClient.OnEndAddRule(IAsyncResult result) --- End of inner exception stack trace --- at Microsoft.ServiceBus.Messaging.Sbmp.SbmpSubscriptionClient.OnEndAddRule(IAsyncResult result) at Microsoft.ServiceBus.Messaging.SubscriptionClient.AddRule(RuleDescription description) at ServiceBusReciver.ServiceBusReciverBuilder.InitRecivers() in G:\\Documents\\Visual Studio 2015\\Projects\\ServiceBusReciver\\ServiceBusReciver\\ServiceBusReciverBuilder.cs:line 42
There was a issue in WindowsAzure.ServiceBus.dll version. I downgraded the version of WindowsAzure.ServiceBus.dll from 4.1.3 to 4.1.2 it's working perfect.
EDIT : This issue is getting again
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.