c# - 发送或监听时出错,Azure ServiceBus

标签 c# .net azure servicebus

我有一个客户端,用于发送和监听 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/

相关文章:

.net - 如何在clickonce部署时修改配置文件?

json - 部署模板解析失败 : 'Required property ' type' not found in JSON. 路径 '',行,位置。'。 (代码:无效模板)

powershell - 使用 PowerShell 获取要交换的 Azure Web 应用设置列表

c# - 我想生成具有角标(Badge)和声音功能的 iOS 推送通知有效负载,我可以使用哪些类和库? [C#]

c# - c# - 如何从指定字符串中拆分单词?

c# - 动态创建实体实例并添加新条目

c# - 使用存储过程时如何检查删除/更新操作是否成功完成?

.net - 如何将日期时间插入SQL数据库表中?

c# - 使用实体配置与多个表的一对一/一关系

c# - 使用数据注释的 mvc 模型中的默认值