EventProcessorHost在带有多个实例的webjob中使用 - 给出异常Microsoft.ServiceBus.Messaging.LeaseLostException

时间:2017-04-10 21:46:21

标签: azure azure-eventhub event-processor-host

我在webjob中使用带有多个实例的EventProcessorHost - 给出异常Microsoft.ServiceBus.Messaging.LeaseLostException。特别是只有一个实例提供此例外。

当我将其作为单个实例运行时,它没有给出任何异常

Microsoft.ServiceBus.Messaging.LeaseLostException:类型&#39; Microsoft.ServiceBus.Messaging.LeaseLostException&#39;的异常类型被扔了。 ---&GT; Microsoft.WindowsAzure.Storage.StorageException:远程服务器返回错误:(409)冲突。 ---&GT; System.Net.WebException:远程服务器返回错误:(409)冲突。    在Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException [T](HttpStatusCode expectedStatusCode,HttpStatusCode actualStatusCode,T retVal,StorageCommandBase 1 cmd, Exception ex) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\Common\Shared\Protocol\HttpResponseParsers.Common.cs:line 50 at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.<>c__DisplayClass33.<RenewLeaseImpl>b__32(RESTCommand 1 cmd,HttpWebResponse resp,Exception ex,OperationContext ctx)在c:\ Program中文件(x86)\ Jenkins \ workspace \ release_dotnet_master \ Lib \ ClassLibraryCommon \ Blob \ CloudBlob.cs:第3186行    在Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse [T](IAsyncResult getResponseResult)中的c:\ Program Files(x86)\ Jenkins \ workspace \ release_dotnet_master \ Lib \ ClassLibraryCommon \ Core \ Executor \ Executor.cs:line 299    ---内部异常堆栈跟踪结束---    at c:\ Program Files(x86)\ Jenkins \ workspace \ release_dotnet_master \ Lib \ ClassLibraryCommon \ Core \ Executor \ Executor.cs中的Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync [T](IAsyncResult result):line 50    在c:\ Program Files(x86)\ Jenkins \ workspace \ release_dotnet_master \ Lib \ ClassLibraryCommon \ Blob \ CloudBlob.cs:line 1982中的Microsoft.WindowsAzure.Storage.Blob.CloudBlob.EndRenewLease(IAsyncResult asyncResult)    在Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions。&lt;&gt; c__DisplayClass4.b__3(IAsyncResult ar)在c:\ Program Files(x86)\ Jenkins \ workspace \ release_dotnet_master \ Lib \ ClassLibraryCommon \ Core \ Util \ AsyncExtensions中。 cs:第114行 ---从抛出异常的先前位置开始的堆栈跟踪结束---    在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)    在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)    在Microsoft.ServiceBus.Messaging.BlobLeaseManager.d__23.MoveNext()    ---内部异常堆栈跟踪结束---    在Microsoft.ServiceBus.Messaging.BlobLeaseManager.d__23.MoveNext() ---从抛出异常的先前位置开始的堆栈跟踪结束---    在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)    在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)    在Microsoft.ServiceBus.Messaging.BlobLeaseManager.d__24.MoveNext() ---从抛出异常的先前位置开始的堆栈跟踪结束---    在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)    在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)    在D:\ a \ 1 \ s \ RoutingServiceWebJob \ DataProcessorFactory \ EventHubDataProcessor.cs中的RoutingServiceWebJob.DataProcessorFactory.EventHubDataProcessor.d__37.MoveNext():第163行

我正在一次阅读一条消息。请建议。

1 个答案:

答案 0 :(得分:0)

我可以通过将主机名设置为唯一字符串来避免这种情况。例如

var eventProcessorHostName = Guid.NewGuid().ToString();