AzureWebJobsDashboard 配置错误

AzureWebJobsDashboard Configuration Error

我在 Visual Studio 2015 年使用 .NET Framework 4.6 创建了一个新的 Azure WebJob 项目。

在app.config中,我设置了三个连接字符串:

  1. AzureWebJobsDashboard
  2. AzureWebJobsStorage
  3. MyDatabaseConnectionString

AzureWebJobsDashboard 和 AzureWebJobsStorage 连接字符串相同,它们都指向我的存储帐户。我包括其中一个连接字符串——因为它们都是相同的,除了 "name".

<add name="AzureWebJobsDashboard" connectionString="DefaultEndpointsProtocol=https;AccountName=mystorageaccountname;AccountKey=thisIsTheLongPrimaryKeyICopiedFromAzurePortalForMyStorageAccount" />

我觉得一切正常,但出现以下错误:

The configuration is not properly set for the Microsoft Azure WebJobs Dashboard. In your Microsoft Azure Website configuration you must set a connection string named AzureWebJobsDashboard by using the following format DefaultEndpointsProtocol=https;AccountName=NAME;AccountKey=KEY pointing to the Microsoft Azure Storage account where the Microsoft Azure WebJobs Runtime logs are stored.

顺便说一下,我知道 app.config 正在被 Web 作业读取,因为我的代码能够连接到我的数据库并更新一些记录。

知道我做错了什么吗?

您需要在 Web 应用程序设置边栏选项卡的门户中设置 AzureWebJobsDashboard 连接字符串(执行此操作的步骤 here)。仪表板作为单独的站点扩展运行,无权访问 app.config。将连接字符串添加到设置边栏选项卡上的 连接字符串 部分。

您也可以在其中添加其他连接字符串(例如 AzureWebJobsStorage),而不是存储在 app.config 中,如果您希望 security/consistency,但是WebJob 可以从 app.config.

读取 AzureWebJobsStorage

目前(Web Job Tools 版本为 15.0.31201.0)无需从 Azure 门户配置任何连接字符串,足以在 Web 作业的 app.config 文件中设置它

更改需要在 Azure 门户的应用服务设置中完成

为此

  1. https://portal.azure.com
  2. 打开 Azure(管理)门户
  3. 转到主页 > 应用程序服务
  4. Select 托管您的 WebJob 的应用程序服务
  5. 转到设置> 选择应用程序设置
  6. 向下滚动到 连接字符串
  7. 添加名称为 'AzureWebJobsDashboard' 且值为 的新连接字符串。选择类型 'Custom'
  8. 按保存按钮(在页面顶部)

大功告成!检查您的 Webjobs 仪表板 - 顶部的警告和错误消息现在应该消失了。

我也遇到了这个问题。

我的存储帐户类型是 StorageV2 (general purpose V2)

我在应用服务配置中正确设置了 AzureWebJobsDashboardAzureWebJobsStorage

但是,存储帐户的 Minimum TLS version 设置为 1.2

我发现需要将其更改为 1.0 才能使 WebJobs 仪表板正确显示,并将 WebJobs 更改为 运行 正常。