I'm facing a random error when sending message from an Azure function to an Azure Service Bus (Standard) Topic.
the message error is:
Cannot access a disposed object. Object name: 'tls2576'., Stacktrace : at Microsoft.Azure.ServiceBus.Core.MessageSender.OnSendAsync(IList
1 messageList) at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func
1 operation, TimeSpan operationTimeout) at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func1 operation, TimeSpan operationTimeout) at Microsoft.Azure.ServiceBus.Core.MessageSender.SendAsync(IList
1 messageList) at ServiceBusFunctions.MyTopic.Run(HttpRequest req, ILogger log, ExecutionContext context) in myAzureFunction
sometimes the object name in the error is 'tls2716'.
The code is running from an Azure function instance containing 3 functions. Tere are 2 redundant functions APP containing the same code called in round robin from an Application Gateway. The client code to send messages to the topic is:
var message =newMessage(Encoding.UTF8.GetBytes(requestBody));//Custom properties for topis routing
message.UserProperties.Add("P1", P1);
message.UserProperties.Add("P2", P2);
message.UserProperties.Add("P3", P3);ITopicClient topicClient =newTopicClient(SBConnectionString,CCTopicName);
await topicClient.SendAsync(message);
await topicClient.CloseAsync();
thanks for your help