简体   繁体   English

无法访问已处置的对象。 对象名称:'tlsxyz'

[英]Cannot access a disposed object. Object name: 'tlsxyz'

I'm facing a random error when sending message from an Azure function to an Azure Service Bus (Standard) Topic.从 Azure 函数向 Azure 服务总线(标准)主题发送消息时,我遇到随机错误。

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(Func 1 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对象名称:'tls2576'., Stacktrace:在 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(Func 1 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'.有时错误中的对象名称是“tls2716”。

The code is running from an Azure function instance containing 3 functions.代码从包含 3 个函数的 Azure 函数实例运行。 Tere are 2 redundant functions APP containing the same code called in round robin from an Application Gateway.有 2 个冗余功能 APP 包含从应用程序网关循环调用的相同代码。 The client code to send messages to the topic is:向主题发送消息的客户端代码是:

var message = new Message(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 = new TopicClient(SBConnectionString, CCTopicName);
await topicClient.SendAsync(message);
await topicClient.CloseAsync();

thanks for your help感谢您的帮助

The problem was closing the static topic client when a conccurent call is using it.问题是在并发调用使用静态主题客户端时关闭它。 the Fix is not to close the topicclient to reuse it and minimze the number of connection and tunning performance when open a connection修复是不关闭主题客户端以重新使用它并在打开连接时最小化连接数量和调整性能

发生这种情况是由于在从内存中清除后访问已处理的对象。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法访问已处置的对象。 对象名称:“ NumericUpDown” - Cannot access a disposed object. Object name: 'NumericUpDown' AutoMapper IValueResolver:无法访问已处理的对象。 对象名称:'IServiceProvider' - AutoMapper IValueResolver: Cannot access a disposed object. Object name: 'IServiceProvider' ObjectDisposedException:无法访问已处置的对象。 对象名称:“调度程序” - ObjectDisposedException: Cannot access a disposed object. Object name: 'Dispatcher' C#'无法访问已处置的对象。 对象名称:“ SslStream”。 - C# 'Cannot access a disposed object. Object name: 'SslStream'.' HangFire“无法访问已处置的对象。对象名称:'SqlDelegatedTransaction'” - HangFire "Cannot access a disposed object. Object name: 'SqlDelegatedTransaction'" 无法访问已处置的对象。\\ r \\ n对象名称:“ ApplicationUserManager” - Cannot access a disposed object.\r\nObject name: 'ApplicationUserManager' 无法访问已处置的对象。 交易 - Cannot access a disposed object. Transaction 无法访问已处置的对象。 与XPO - Cannot access a disposed object. with XPO 我有一个 singleton 表单名称 FCD 无法访问已处理的 object 的问题。 Object 名称:'FCD'。 - I have this problem with a singleton form name FCD Cannot access a disposed object. Object name: 'FCD'.' 尝试运行SpecFlow NUnit测试时出错:“无法访问已处置的对象。 对象名称:“ GherkinLanguageService”” - Error when attempting to run SpecFlow NUnit test: “Cannot access a disposed object. Object name: 'GherkinLanguageService'”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM