当我创建新的Azure webjob项目时,我可以在 app.config
部分中看到connectionstring部分,如下所示:
<connectionStrings>
<!-- The format of the connection string is "DefaultEndpointsProtocol=https;AccountName=NAME;AccountKey=KEY" -->
<!-- For local execution, the value can be set either in this config file or through environment variables -->
<add name="AzureWebJobsDashboard" connectionString="" />
<add name="AzureWebJobsStorage" connectionString="" />
</connectionStrings>
在我的webjob函数中我只与我的应用程序db交互 .
那么我真的需要为azure webjobs创建另外两个数据库吗?
当我从visual studio运行webjobs时,我收到以下错误:
应用程序:WebJobTest.exe Framework版本:v4.0.30319描述:由于未处理的异常,进程已终止 . 异常信息:System.InvalidOperationException Stack:位于Microsoft.Azure的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) WebJobTest.Program.Main()中的.WebJobs.JobHost.Call(System.Reflection.MethodInfo,System.Object)
当我尝试访问webjobs日志时,它显示:WebJob详细信息WebJobTest
请确保您设置一个名为AzureWebJobsDashboard在微软Azure网站配置使用以下格式DefaultEndpointsProtocol = HTTPS连接字符串,帐户名=名称; AccountKey =键指向微软Azure存储帐户在微软Azure WebJobs运行日志存储 .
我想这是因为没有正确的数据库连接字符串 .
上述两个错误之间可能存在什么联系?
2 回答
AzureWebJobsDashboard 连接字符串是可选的 - 如果您希望能够将仪表板UI用于日志等,则只需要它 .
需要 AzureWebJobsStorage 连接字符串 - 虽然您可能没有使用任何存储实体,但WebJobs运行时确实使用某些blob和其他存储实体来进行自己的跟踪和操作 .
添加到Mathew的答案,只有在使用WebJobs SDK时才需要 AzureWebJobsStorage ,要使用Azure WebJobs,您必须拥有 AzureWebJobsStorage 连接字符串 .