我有一个客户端,用于发送和监听 Azure ServiceBus 中的主题。客户端在我的 Windows 8.1 计算机上本地运行。但我在 SendAsync 和 ReceiveAsync 上遇到以下异常:
A first chance exception of type 'System.InvalidOperationException' occurred in System.dll
Additional information: The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.
代码如下所示:
string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
var client = SubscriptionClient.CreateFromConnectionString(connectionString, topic, subscriptionId);
while(true)
{
var message = await client.ReceiveAsync();
和
string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
TopicClient client =
TopicClient.CreateFromConnectionString(connectionString, topic);
var msgToSend = new BrokeredMessage(msg);
await client.SendAsync(msgToSend);
Ang 有人能解决这个问题吗?
最佳答案
这是一个与防火墙相关的问题。
关于c# - 发送或监听时出错,Azure ServiceBus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28495614/