Azure本地开发队列ConnectionString

时间:2013-10-29 19:31:53

标签: azure

我在VS 2013中使用QueueWorkerRole的模板创建了一个新的WorkerRole,它创建的代码如下所示:

        // Create the queue if it does not exist already
        var connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
        var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
        if (!namespaceManager.QueueExists(QueueName))
        {
            namespaceManager.CreateQueue(QueueName);
        }

        // Initialize the connection to Service Bus Queue
        _client = QueueClient.CreateFromConnectionString(connectionString, QueueName);

我遇到的问题是正确设置Microsoft.ServiceBus.ConnectionString,以便它可以与在模拟器中运行的本地开发队列一起使用。默认设置如下:

<appSettings>
    <!-- Service Bus specific app setings for messaging connections -->
    <add key="Microsoft.ServiceBus.ConnectionString" value="Endpoint=sb://[your namespace].servicebus.windows.net;SharedSecretIssuer=owner;SharedSecretValue=[your secret]" />
</appSettings>

我猜这个可以正常工作,当我有一个托管服务连接到但我只是在本地尝试一些东西而不能让它连接。

我尝试了“UseDevelopmentStorage = True”,我尝试使用我在查看存储模拟器UI“127.0.0.1:10001”时找到的地址以及使用我在此处找到的标准格式的本地模拟器:{{3 (DefaultEndpointsProtocol = https; AccountName = devstoreaccount1; AccountKey = Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq / K1SZFPTOtr / KBHBeksoGMGw ==;)但我没有运气。

有时我在Compute Emulator UI中看到“Service Bus连接字符串包含无效属性”,有时我收到无法连接的错误。

感谢。

1 个答案:

答案 0 :(得分:1)

您遇到的问题是您正在尝试将队列连接字符串插入服务总线连接字符串创建器。这两个连接字符串本质上是不同的。

要使用开发存储,您需要将要使用的应用设置键的值设置为:&#34; UseDevelopmentStorage = true&#34;如此堆栈溢出中所示: Windows Azure Storage Emulator Connection String for ASP.NET MVC?这适用于STORAGE(非服务总线)

相关问题