use*_*080 6 c# servicebus azure
I'm not sure what has changed but all of a sudden I get an "InvalidOperationException - Operation is not valid due to the current state of the object". My code has definitely worked previously and I can't remember changing anything.
I'm using Microsoft.Azure.ServiceBus 4.1.3
I tried some very basic code and still get the same error:
var bus = new QueueClient("Endpoint=sb://xxx.servicebus.windows.net/;SharedAccessKeyName=Manage;SharedAccessKey=xxx", "service-event");
await bus.SendAsync(new Message(Encoding.UTF8.GetBytes("{\"test\":\"hi\"}")));
Run Code Online (Sandbox Code Playgroud)
Any ideas?
Edit stacktrace:
at Microsoft.Azure.ServiceBus.Core.MessageSender.<OnSendAsync>d__58.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at Microsoft.Azure.ServiceBus.RetryPolicy.<RunOperation>d__19.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Azure.ServiceBus.RetryPolicy.<RunOperation>d__19.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Microsoft.Azure.ServiceBus.Core.MessageSender.<SendAsync>d__45.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at TwitchEventAdapter.EventHandler.<SendEvent>d__2.MoveNext() in C:\...\EventHandler.cs:line 66
Run Code Online (Sandbox Code Playgroud)
Sea*_*ron 16
如果您使用的是 .Net 5.0 RC2,则安装Microsoft.Azure.ServiceBus 5.0.0 版应该可以解决问题。
| 归档时间: |
|
| 查看次数: |
1241 次 |
| 最近记录: |