简体   繁体   English

将Azure存储模拟器与Webjob一起使用的连接字符串是什么?

[英]What is the connection string to use Azure Storage Emulator with a Webjob?

I have a simple WebJob which I wish to test with the Azure Storage Emulator. 我有一个简单的WebJob,我希望使用Azure存储模拟器进行测试。

I currently have set the AzureJobsRuntime and AzureJobsData set to use development storage as follows: 我目前已将AzureJobsRuntime和AzureJobsData集设置为使用开发存储,如下所示:

<connectionStrings>
    <add name="AzureJobsRuntime" connectionString="UseDevelopmentStorage=true;" />
    <add name="AzureJobsData" connectionString="UseDevelopmentStorage=true;" />
</connectionStrings>

The webjob is very simple: webjob非常简单:

public static void Main(string[] args)
{
    JobHost host = new JobHost();
    host.RunAndBlock();
}

public static void Process([QueueInput("queue")] string input, [BlobOutput("containername/blobname")]TextWriter writer)
{

}

This throws an exception on startup: 这会在启动时抛出异常:

InvalidOperationException: InvalidOperationException异常:

Windows Azure Storage account connection string is not formatted correctly Windows Azure存储帐户连接字符串格式不正确

I have been able to create the queue and add messages to it from a website using the same connection string and the CloudStorageAccount class. 我已经能够使用相同的连接字符串和CloudStorageAccount类创建队列并从网站添加消息。

遗憾的是,WebJobs SDK不支持使用Azure存储模拟器,因为此模拟器不支持它使用的某些功能。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM