简体   繁体   English

Azure 本地开发队列 ConnectionString

[英]Azure Local Development Queue ConnectionString

I have created a new WorkerRole using the template for a QueueWorkerRole in VS 2013 and it creates code that looks like this:我在 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);

The problem I ma having is setting the Microsoft.ServiceBus.ConnectionString correctly so that it will work with my local development queues running in the emulator.我遇到的问题是正确设置 Microsoft.ServiceBus.ConnectionString,以便它可以与在模拟器中运行的本地开发队列一起使用。 By default it sets it up like this:默认情况下,它设置如下:

<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>

And I'm guessing this will work fine when I have a hosted service to connect to but I am just trying out some things locally and can't get it to connect.我猜当我有一个托管服务要连接时,这会正常工作,但我只是在本地尝试一些东西而无法连接。

I have tried "UseDevelopmentStorage=True" and I've tried using the address I found when viewing the Storage Emulator UI "127.0.0.1:10001" as well as the Local Emulator using Standard Format I found here: http://www.connectionstrings.com/windows-azure/ (DefaultEndpointsProtocol=https;AccountName=devstoreaccount1; AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;) but I am having no luck.我尝试过“UseDevelopmentStorage=True”,并且尝试使用在查看存储模拟器 UI“127.0.0.1:10001”时找到的地址以及使用我在此处找到的标准格式的本地模拟器: http://www。 connectionstrings.com/windows-azure/(DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZekFPsoGw==没有运气)

Sometimes I am seeing "The Service Bus connection string contains invalid property" in the Compute Emulator UI and other times I get an error that it can't connect.有时我会在 Compute Emulator UI 中看到“服务总线连接字符串包含无效属性”,有时我会收到无法连接的错误。

Thanks.谢谢。

The problem you are having here is that you are attempting to plug a queue connection string into a Service Bus Connection String Creator.您在这里遇到的问题是您试图将队列连接字符串插入服务总线连接字符串创建器。 Those two connection strings are inherently different.这两个连接字符串本质上是不同的。

To use development storage you need to set the value of the app setting key you wish to use to: "UseDevelopmentStorage=true" as seen in this stack overflow: Windows Azure Storage Emulator Connection String for ASP.NET MVC?要使用开发存储,您需要设置要使用的应用设置键的值:“UseDevelopmentStorage=true”,如堆栈溢出: Windows Azure Storage Emulator Connection String for ASP.NET MVC? This will work for STORAGE (not service bus)这适用于 STORAGE(不是服务总线)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Azure上的WebJob中使用connectionstring - Use connectionstring in WebJob on Azure 缓慢的天蓝色队列webjob性能(本地开发) - Slow azure queue webjob performance (local dev) Azure Function 使用来自 Azure Key Vault 本地开发的连接 - Azure Function to use connection from Azure Key Vault local development Azure 队列存储 Visual Studio 本地主机从 QueueClient 发送的所有队列消息进入毒队列 - Azure Queue Storage visual studio local host all queue messages sent from QueueClient going to poison queue settings.settings开发与生产中的连接字符串 - settings.settings connectionstring in development vs production VS中的Azure函数本地开发找不到函数 - Azure function local development in VS cannot find function 具有托管标识的 Azure 应用程序配置的本地开发访问权限 - Local development access to Azure App Configuration with a managed identity 连接字符串的临时路径中的SQLCe本地数据库? - SQLCe local db in temp- path in connectionstring? Azure Web 应用程序未在 Kudu Env 中显示连接字符串 - Azure Web App Not Showing Connectionstring in Kudu Env C#生成Azure表存储ConnectionString - C# Generate Azure Table Storage ConnectionString
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM