本文介绍了服务总线1.1 WindowsAzure.ServiceBus DLL创建队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我准备开发的应用程序,连接到Azure的服务总线。对于开发我想使用的服务总线1.1。 我已经安装了localY坐标服务总线1.1,当我与包的服务Bus.v1_1版本连接它工作正常。 1.0.5 但我想最终与Azure的工作,我喜欢用包WindowsAzure服务总线,因为我知道与服务总线1.1 sholud工作。 但是,当我想要执行: namespaceManager.QueueExists( QUEUENAME) 是 WindowsAzure.ServiceBus版本3.1.2 包我收到: 'System.ArgumentException'.... 远程服务器返回错误:(400)错误的请求。不支持的API的版本在查询字符串。无论是从乌里删除或使用2012-03,2012-08,2013-04,2013-07之一。 添加?API_VERSION = 2013年7月来URI不帮助。 的但是发送消息队列存在本地SB1.1效果很好(使用WindowsAzure.ServiceBys 3.1.2)。的所以只用于NamespaceManager连接。 难道任何人有任何想法,为什么它不工作? 我使用的测试代码: VAR CS =终点= 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); 变种版本= namespaceManager.GetVersionInfo(); 如果(namespaceManager.QueueExists(QUEUENAME)) { namespaceManager.DeleteQueue(QUEUENAME); } namespaceManager.CreateQueue(QUEUENAME); QueueClient客户端= messagingFactory.CreateQueueClient(QUEUENAME); client.Send(新BrokeredMessage(你好!+ DateTime.Now)); 客户端= messagingFactory.CreateQueueClient(QUEUENAME,ReceiveMode.ReceiveAndDelete); BrokeredMessage消息= client.Receive(); 如果(消息!= NULL) { Console.WriteLine(message.GetBody<串GT;()); } Console.ReadKey(); 解决方案 据我所知,WindowsAzure.ServiceBus包不兼容与楼宇的Windows服务总线。我们坚持使用旧的包。 我相信库源大部分事情兼容的,所以当你迁移到使用Azure的服务总线,而不是在-PREM ,那么它应该是为换出包和改变身份验证机制和连接字符串并重新编译和测试一样简单。 I am preparing to develop application that connects to Azure Service Bus. For development I want use Service Bus 1.1.I have installed localy Service Bus 1.1 and it works fine when I am connecting with package Service Bus.v1_1 ver. 1.0.5.But as I want eventually work with Azure I prefer to use package WindowsAzure Service Bus which as I know sholud work with Service Bus 1.1.But when I want to execute:namespaceManager.QueueExists(queueName)with WindowsAzure.ServiceBus ver 3.1.2 package I receive:'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'.Adding ?api_version=2013-07 to Uri does not helps.However sending message to queue that exists on local SB1.1 works well (Using WindowsAzure.ServiceBys 3.1.2).So it just applies to connections with NamespaceManager.Could anyone has any ideas why it does not work ?The code I use for tests: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(); 解决方案 To my knowledge the WindowsAzure.ServiceBus package is not compatible with on premises Windows Service Bus. We are stuck with using the old package.I believe the libraries are source compatible for most things, so when you DO migrate to using Azure service bus instead of on-prem, then it should be as simple as swapping out the package and changing the authentication mechanisms and connection strings and recompiling and testing. 这篇关于服务总线1.1 WindowsAzure.ServiceBus DLL创建队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-14 06:22