Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Azure服务总线:AMQP对象正在关闭。操作';附上';无法执行_C#_Azure_Azureservicebus - Fatal编程技术网

C# Azure服务总线:AMQP对象正在关闭。操作';附上';无法执行

C# Azure服务总线:AMQP对象正在关闭。操作';附上';无法执行,c#,azure,azureservicebus,C#,Azure,Azureservicebus,我在西欧数据中心将Azure服务总线主题与AMQP协议一起使用。 这是实现的解决方案工作原理的示意图: private Microsoft.Azure.ServiceBus.SubscriptionClient CreateClient() { string serviceBusConnectionString; strin serviceBusTopicName; string subscriptionName; var subscriptionClient

我在西欧数据中心将Azure服务总线主题与AMQP协议一起使用。 这是实现的解决方案工作原理的示意图:

private Microsoft.Azure.ServiceBus.SubscriptionClient CreateClient() {
    string serviceBusConnectionString;
    strin serviceBusTopicName;
    string subscriptionName;

    var subscriptionClient = new Microsoft.Azure.ServiceBus.SubscriptionClient(serviceBusConnectionString, serviceBusTopicName, subscriptionName) {
                PrefetchCount = 0
            };
    return subscriptionClient;
}

public async Task<ISubscriptionClient> CreateSubscriptionClientAsync() {
    //Some logic on the subscriptionClient, caching, creating a new one if it doesn't exists, etc.
    return CreateClient()
}

private async Task CallbackAsync(Message msg, CancellationToken cancellationToken) {
    //Do stuff with the Message
    //when you're done Completethe message
}

public async Task<string> OpenAsync(CancellationToken cancellationToken) {
    subscriptionClient = await CreateSubscriptionClientAsync().ConfigureAwait(false);
    var messageHandlerOptions = new MessageHandlerOptions(ExceptionReceivedHandlerAsync) {
            AutoComplete = false,
            MaxAutoRenewDuration = TimeSpan.FromHours(8)
    };
    subscriptionClient.RegisterMessageHandler(CallbackAsync, messageHandlerOptions);
    return string.Empty;
}
私有Microsoft.Azure.ServiceBus.SubscriptionClient CreateClient(){
字符串serviceBusConnectionString;
strin serviceBusTopicName;
字符串subscriptionName;
var subscriptionClient=new Microsoft.Azure.ServiceBus.subscriptionClient(serviceBusConnectionString,serviceBusTopicName,subscriptionName){
预取计数=0
};
返回订阅客户端;
}
公共异步任务CreateSubscriptionClientAsync(){
//subscriptionClient上的一些逻辑、缓存、创建一个新的(如果它不存在)等等。
返回CreateClient()
}
专用异步任务CallbackAsync(消息msg,CancellationToken CancellationToken){
//用信息做些事情
//完成后,请完成此消息
}
公共异步任务OpenAsync(CancellationToken CancellationToken){
subscriptionClient=await CreateSubscriptionClientAsync().ConfigureAwait(false);
var messagehandler options=新的messagehandler选项(例外ReceivedHandlerAsync){
自动完成=错误,
MaxAutoRenewDuration=TimeSpan.FromHours(8)
};
RegisterMessageHandler(CallbackAsync、messageHandlerOptions);
返回字符串。空;
}
但昨晚我有几千个例外,像这样:

Exception: "System.InvalidOperationException: The AMQP object g2b-sessionXXXXXXXX is closing. Operation 'attach' cannot be performed.
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<OnReceiveAsync>d__86.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<>c__DisplayClass64_0.<<ReceiveAsync>b__0>d.MoveNext()
异常:“System.InvalidOperationException:AMQP对象g2b sessionXXXXXXXX正在关闭。无法执行“附加”操作。
位于Microsoft.Azure.ServiceBus.Core.MessageReceiver.d_u86.MoveNext()上
---来自引发异常的上一个位置的堆栈结束跟踪---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在Microsoft.Azure.ServiceBus.Core.MessageReceiver.c__DisplayClass64_0.d.MoveNext()上
我正在使用Microsoft.Azure.ServiceBus v3.1.0.0, 在网上,我没有发现任何关于“无法执行“附加”操作的有用信息

在消息总线上,我没有找到关于这个特定问题的任何信息。在消息总线中,也没有任何关于服务总线中断的参考

以前有人遇到过这个问题吗?
导致异常的原因是什么?
我是否需要实现任何重试逻辑?如何实现?
非常感谢您的帮助,谢谢