首页 > 解决方案 > .NET 4.6/4.7(非 4.5)上的 Azure 云服务(经典)Microsoft.ServiceBus 异常

问题描述

最近我们不得不将我们的代码库从 .NET 4.5 更新到 .NET 4.6.1(或更高版本),所以我们更新到了 4.7.1。

我们的网站以及在云服务上运行的一项服务正在成功运行(在我们发现如何在服务器上安装 .NET 4.7 之后)。但是,我们使用 Microsoft.ServiceBus 连接到 NServiceBus 队列的一项服务不会在 .NET 4.5 之外运行。

降级回 4.5 使一切恢复正常。

我们正在使用以下软件包:

<package id="AutoMapper" version="3.3.1" targetFramework="net471" />
<package id="EntityFramework" version="6.1.3" targetFramework="net471" />
<package id="log4net" version="2.0.5" targetFramework="net471" />
<package id="Microsoft.Data.Edm" version="5.6.2" targetFramework="net471" />
<package id="Microsoft.Data.OData" version="5.6.2" targetFramework="net471" />
<package id="Microsoft.Data.Services.Client" version="5.6.2" targetFramework="net471" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net471" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net471" />
<package id="NServiceBus" version="5.2.4" targetFramework="net471" />
<package id="NServiceBus.Azure" version="6.2.1" targetFramework="net471" />
<package id="NServiceBus.Azure.Transports.WindowsAzureServiceBus" version="6.3.3" targetFramework="net471" />
<package id="NServiceBus.Host" version="6.0.0" targetFramework="net471" />
<package id="NServiceBus.Hosting.Azure" version="6.2.4" targetFramework="net471" />
<package id="NServiceBus.Log4Net" version="1.0.0" targetFramework="net471" />
<package id="System.Spatial" version="5.6.2" targetFramework="net471" />

我们收到的异常

Microsoft.WindowsAzure.ServiceRuntime Critical: 1 : Unhandled Exception:
System.Runtime.CallbackException: Async Callback threw an exception. ---> Microsoft.ServiceBus.Common.CallbackException: An AsyncCallback threw an exception. ---> System.InvalidOperationException: The IAsyncResult implementation 'Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement+ReconnectChannelFactory`1+RequestSessionChannel+RequestAsyncResult[System.ServiceModel.Channels.IRequestSessionChannel]' tried to complete a single operation multiple times. This could be caused by an incorrect application of IAsyncResult implementation or other extensibility code, such as an IAsyncResult that returns incorrect CompletedSynchronously values, or invokes the AsyncCallback multiple times.
at Microsoft.ServiceBus.Common.AsyncResult.Complete(Boolean didCompleteSynchronously, Exception e)
at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at Microsoft.ServiceBus.Common.AsyncResult.TryComplete(Boolean didCompleteSynchronously, Exception exception)
--- End of inner exception stack trace ---
at Microsoft.ServiceBus.Common.AsyncResult.TryComplete(Boolean didCompleteSynchronously, Exception exception)
at Microsoft.ServiceBus.Common.AsyncResult.Complete(Boolean didCompleteSynchronously, Exception e)
at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.Runtime.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.Runtime.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OpenAsyncResult.OnEstablishConnection(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnectionAsyncResult.OnProcessConnection(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreambleAsyncResult.OnUpgrade(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgradeAsyncResult.OnInitiateUpgrade(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.StreamSecurityUpgradeInitiatorAsyncResult.OnAuthenticateAsClient(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Security.SslState.FinishHandshake(Exception e, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ReadFrameCallback(AsyncProtocolRequest asyncRequest)
at System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)
at System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)
at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ConnectionStream.IOAsyncResult.OnAsyncIOComplete(Object state)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
(998.d94): CLR exception - code e0434352 (first chance)
(998.d94): CLR exception - code e0434352 (first chance)
Unhandled exception occured: System.Runtime.CallbackException: Async Callback threw an exception. ---> Microsoft.ServiceBus.Common.CallbackException: An AsyncCallback threw an exception. ---> System.InvalidOperationException: The IAsyncResult implementation 'Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement+ReconnectChannelFactory`1+RequestSessionChannel+RequestAsyncResult[System.ServiceModel.Channels.IRequestSessionChannel]' tried to complete a single operation multiple times. This could be caused by an incorrect application of IAsyncResult implementation or other extensibility code, such as an IAsyncResult that returns incorrect CompletedSynchronously values, or invokes the AsyncCallback multiple times.
at Microsoft.ServiceBus.Common.AsyncResult.Complete(Boolean didCompleteSynchronously, Exception e)
at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at Microsoft.ServiceBus.Common.AsyncResult.TryComplete(Boolean didCompleteSynchronously, Exception exception)
--- End of inner exception stack trace ---
at Microsoft.ServiceBus.Common.AsyncResult.TryComplete(Boolean didCompleteSynchronously, Exception exception)
at Microsoft.ServiceBus.Common.AsyncResult.Complete(Boolean didCompleteSynchronously, Exception e)
at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.Runtime.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.Runtime.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OpenAsyncResult.OnEstablishConnection(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnectionAsyncResult.OnProcessConnection(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreambleAsyncResult.OnUpgrade(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgradeAsyncResult.OnInitiateUpgrade(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.StreamSecurityUpgradeInitiatorAsyncResult.OnAuthenticateAsClient(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Security.SslState.FinishHandshake(Exception e, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ReadFrameCallback(AsyncProtocolRequest asyncRequest)
at System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)
at System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)
at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ConnectionStream.IOAsyncResult.OnAsyncIOComplete(Object state)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>RdRuntime</AppDomain><Exception><ExceptionType>System.Runtime.CallbackException, System.ServiceModel.Internals, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</ExceptionType><Message>Async Callback threw an exception.</Message><StackTrace>    at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.Runtime.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.Runtime.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OpenAsyncResult.OnEstablishConnection(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnectionAsyncResult.OnProcessConnection(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreambleAsyncResult.OnUpgrade(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgradeAsyncResult.OnInitiateUpgrade(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.StreamSecurityUpgradeInitiatorAsyncResult.OnAuthenticateAsClient(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Security.SslState.FinishHandshake(Exception e, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ReadFrameCallback(AsyncProtocolRequest asyncRequest)
at System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)
at System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)
at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ConnectionStream.IOAsyncResult.OnAsyncIOComplete(Object state)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)</StackTrace><ExceptionString>System.Runtime.CallbackException: Async Callback threw an exception. ---&amp;gt; Microsoft.ServiceBus.Common.CallbackException: An AsyncCallback threw an exception. ---&amp;gt; System.InvalidOperationException: The IAsyncResult implementation 'Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement+ReconnectChannelFactory`1+RequestSessionChannel+RequestAsyncResult[System.ServiceModel.Channels.IRequestSessionChannel]' tried to complete a single operation multiple times. This could be caused by an incorrect application of IAsyncResult implementation or other extensibility code, such as an IAsyncResult that returns incorrect CompletedSynchronously values, or invokes the AsyncCallback multiple times.
at Microsoft.ServiceBus.Common.AsyncResult.Complete(Boolean didCompleteSynchronously, Exception e)
at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at Microsoft.ServiceBus.Common.AsyncResult.TryComplete(Boolean didCompleteSynchronously, Exception exception)
--- End of inner exception stack trace ---
at Microsoft.ServiceBus.Common.AsyncResult.TryComplete(Boolean didCompleteSynchronously, Exception exception)
at Microsoft.ServiceBus.Common.AsyncResult.Complete(Boolean didCompleteSynchronously, Exception e)
at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.Runtime.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.Runtime.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OpenAsyncResult.OnEstablishConnection(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnectionAsyncResult.OnProcessConnection(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreambleAsyncResult.OnUpgrade(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgradeAsyncResult.OnInitiateUpgrade(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.StreamSecurityUpgradeInitiatorAsyncResult.OnAuthenticateAsClient(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Security.SslState.FinishHandshake(Exception e, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ReadFrameCallback(AsyncProtocolRequest asyncRequest)
at System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)
at System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)
at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.ConnectionStream.IOAsyncResult.OnAsyncIOComplete(Object state)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)</ExceptionString><InnerException><ExceptionType>Microsoft.ServiceBus.Common.CallbackException, Microsoft.ServiceBus, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</ExceptionType><Message>An AsyncCallback threw an exception.</Message><StackTrace>    at Microsoft.ServiceBus.Common.AsyncResult.TryComplete(Boolean didCompleteSynchronously, Exception exception)
at Microsoft.ServiceBus.Common.AsyncResult.Complete(Boolean didCompleteSynchronously, Exception e)
at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)</StackTrace><ExceptionString>Microsoft.ServiceBus.Common.CallbackException: An AsyncCallback threw an exception. ---&amp;gt; System.InvalidOperationException: The IAsyncResult implementation 'Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement+ReconnectChannelFactory`1+RequestSessionChannel+RequestAsyncResult[System.ServiceModel.Channels.IRequestSessionChannel]' tried to complete a single operation multiple times. This could be caused by an incorrect application of IAsyncResult implementation or other extensibility code, such as an IAsyncResult that returns incorrect CompletedSynchronously values, or invokes the AsyncCallback multiple times.
at Microsoft.ServiceBus.Common.AsyncResult.Complete(Boolean didCompleteSynchronously, Exception e)
at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at Microsoft.ServiceBus.Common.AsyncResult.TryComplete(Boolean didCompleteSynchronously, Exception exception)
--- End of inner exception stack trace ---
at Microsoft.ServiceBus.Common.AsyncResult.TryComplete(Boolean didCompleteSynchronously, Exception exception)
at Microsoft.ServiceBus.Common.AsyncResult.Complete(Boolean didCompleteSynchronously, Exception e)
at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)</ExceptionString><DataItems><Data><Key>Microsoft.ServiceBus</Key><Value>Microsoft.ServiceBus</Value></Data></DataItems><InnerException><ExceptionType>System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The IAsyncResult implementation 'Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement+ReconnectChannelFactory`1+RequestSessionChannel+RequestAsyncResult[System.ServiceModel.Channels.IRequestSessionChannel]' tried to complete a single operation multiple times. This could be caused by an incorrect application of IAsyncResult implementation or other extensibility code, such as an IAsyncResult that returns incorrect CompletedSynchronously values, or invokes the AsyncCallback multiple times.</Message><StackTrace>    at Microsoft.ServiceBus.Common.AsyncResult.Complete(Boolean didCompleteSynchronously, Exception e)
at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at Microsoft.ServiceBus.Common.AsyncResult.TryComplete(Boolean didCompleteSynchronously, Exception exception)</StackTrace><ExceptionString>System.InvalidOperationException: The IAsyncResult implementation 'Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement+ReconnectChannelFactory`1+RequestSessionChannel+RequestAsyncResult[System.ServiceModel.Channels.IRequestSessionChannel]' tried to complete a single operation multiple times. This could be caused by an incorrect application of IAsyncResult implementation or other extensibility code, such as an IAsyncResult that returns incorrect CompletedSynchronously values, or invokes the AsyncCallback multiple times.
at Microsoft.ServiceBus.Common.AsyncResult.Complete(Boolean didCompleteSynchronously, Exception e)
at Microsoft.ServiceBus.Common.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)
at Microsoft.ServiceBus.Common.AsyncResult.TryComplete(Boolean didCompleteSynchronously, Exception exception)

提前致谢

标签: c#.netnservicebusazureservicebusazure-cloud-services

解决方案


此问题之前已报告,请确保您使用已修复任何错误的最新版本:

将所有 NServiceBus 包升级到最新的次要/补丁版本?

例如,您使用:

  • NServiceBus 5.2.4,升级到 5.2.26
  • NServiceBus.Azure.Transports.WindowsAzureServiceBus 6.3.3,将此升级到 6.4.2
  • 等等

通过 nuget 包管理器执行此操作相当容易!


推荐阅读