【问题标题】:Service Bus 1.1 creating Queue with WindowsAzure.ServiceBus dllService Bus 1.1 使用 WindowsAzure.ServiceBus dll 创建队列
【发布时间】:2016-04-18 11:33:34
【问题描述】:

我正准备开发连接到 Azure 服务总线的应用程序。对于开发,我想使用 Service Bus 1.1。

我已经安装了本地服务总线 1.1,当我连接包 Service Bus.v1_1 版本时它工作正常。 1.0.5.

但由于我最终希望使用 Azure,我更喜欢使用包 WindowsAzure Service Bus,据我所知,它应该与 Service Bus 1.1 一起使用。

但是当我想执行时:

namespaceManager.QueueExists(queueName)

使用 WindowsAzure.ServiceBus ver 3.1.2 包我收到:

'System.ArgumentException' .... The remote server returned an error: (400) Bad Request. The api-version in the query string is not supported. Either remove it from the Uri or use one of '2012-03,2012-08,2013-04,2013-07'.

?api_version=2013-07 添加到 Uri 没有帮助。

但是,向本地 SB1.1 上存在的队列发送消息效果很好(使用 WindowsAzure.ServiceBys 3.1.2)。 所以它只适用于与 NamespaceManager 的连接。

有人知道为什么它不起作用吗?


我用于测试的代码:

var cs ="Endpoint=sb://mylocalmachine/ServiceBusDefaultNamespace/;StsEndpoint=https://mylocalmachine:9355/ServiceBusDefaultNamespace/;RuntimePort=9354;ManagementPort=9355";
var queueName = "AAA";
var namespaceManager = NamespaceManager.CreateFromConnectionString(cs);
var messagingFactory = MessagingFactory.CreateFromConnectionString(cs);
var ver = namespaceManager.GetVersionInfo();

if (namespaceManager.QueueExists(queueName))
{
    namespaceManager.DeleteQueue(queueName);
}

namespaceManager.CreateQueue(queueName);

QueueClient client = messagingFactory.CreateQueueClient(queueName);
client.Send(new BrokeredMessage("Hello! " + DateTime.Now));


client = messagingFactory.CreateQueueClient(queueName, ReceiveMode.ReceiveAndDelete);
BrokeredMessage message = client.Receive();
if (message != null)
{
    Console.WriteLine(message.GetBody<string>());
}
Console.ReadKey();

【问题讨论】:

    标签: c# azure azureservicebus servicebus


    【解决方案1】:

    据我所知,WindowsAzure.ServiceBus 包与本地 Windows 服务总线不兼容。我们坚持使用旧包。

    我相信这些库在大多数情况下都与源代码兼容,因此当您迁移到使用 Azure 服务总线而不是本地部署时,它应该像换出包并更改身份验证机制和连接字符串一样简单重新编译和测试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-12
      • 2022-08-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多