Azure 函数 - 值不能为空。(参数'connectionString')

Lil*_*mov 1 javascript azure azure-functions

我试图设置简单的 Azure 函数来读取 XML 流并将其同步回数据库。我的计划是使用时间触发器每天执行一次该功能。

然而,事情看起来并不好。即使我不使用数据库,我也会收到以下错误:

[Error] Executed 'Functions.<func-name>' (Failed, Id=<func-id>, Duration=1ms)Value cannot be null. (Parameter 'connectionString')
Run Code Online (Sandbox Code Playgroud)

我目前正在尝试执行以下功能:

module.exports = async function(context, req) {
    context.res = {
        body: "Success!"
    };
};
Run Code Online (Sandbox Code Playgroud)

结果一样。我不能运行它。

我已将连接字符串添加到配置 -> 连接字符串(根据消息,我以为我错过了)。

我的functions.json文件看起来像:

{
  "bindings": [
    {
      "name": "myTimer",
      "type": "timerTrigger",
      "direction": "in",
      "schedule": "0 0 * * * *"
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

我也试过运行 C# 函数 - 结果相同。

那么,我错过了什么?

Lil*_*mov 5

从 Microsoft 登录到它是最好的。

缺少 AzureWebJobsStorage 应用设置。

解决方案:

  1. 创建存储帐户(或使用现有帐户)
  2. 转到您的功能应用程序的配置
  3. 将带有连接字符串的 AzureWebJobsStorage 添加到您的存储帐户(可在存储帐户概述 -> 访问密钥中找到)