【发布时间】:2016-03-21 15:39:53
【问题描述】:
我希望能够在将 Azure WebJobs SDK 项目实际发布到 Azure 之前在本地对其进行测试。
如果我创建一个全新的 Azure Web Jobs 项目,我会得到一些如下所示的代码:
程序.cs:
// To learn more about Microsoft Azure WebJobs SDK, please see http://go.microsoft.com/fwlink/?LinkID=320976
class Program
{
// Please set the following connection strings in app.config for this WebJob to run:
// AzureWebJobsDashboard and AzureWebJobsStorage
static void Main()
{
var host = new JobHost();
// The following code ensures that the WebJob will be running continuously
host.RunAndBlock();
}
}
函数.cs:
public class Functions
{
// This function will get triggered/executed when a new message is written
// on an Azure Queue called queue.
public static void ProcessQueueMessage([QueueTrigger("queue")] string message, TextWriter log)
{
log.WriteLine(message);
}
}
我想测试一下QueueTrigger 函数是否正常工作,但我什至无法做到这一点,因为在host.RunAndBlock(); 上出现以下异常:
“System.InvalidOperationException”类型的未处理异常 发生在 mscorlib.dll 中
其他信息:Microsoft Azure WebJobs SDK 仪表板 连接字符串丢失或为空。微软 Azure 存储 帐号连接字符串可以通过以下方式设置:
在 .config 文件的 connectionStrings 部分中设置名为“AzureWebJobsDashboard”的连接字符串,格式如下 , 或
设置名为“AzureWebJobsDashboard”的环境变量,或者
设置JobHostConfiguration的对应属性。
我运行了存储模拟器,并像这样设置 Azure AzureWebJobsDashboard 连接字符串:
<add name="AzureWebJobsDashboard" connectionString="UseDevelopmentStorage=true" />
但是,当我这样做时,我得到了一个不同的错误
“System.InvalidOperationException”类型的未处理异常 发生在 mscorlib.dll 中
附加信息:无法验证 Microsoft Azure WebJobs SDK 仪表板帐户。 Microsoft Azure 存储模拟器不是 支持,请使用托管在 微软 Azure。
有什么方法可以在本地测试我对 WebJobs SDK 的使用吗?
【问题讨论】:
标签: azure-webjobs azure-webjobssdk