繁体   English   中英

基于 Blob 存储的 Azure 函数触发器无法与存储资源管理器/模拟器一起使用

[英]Blob Storage based Azure Function Trigger is not working with Storage Explorer/Emulator

我需要编写一个 azure 函数来压缩上传到 azure blob 存储中的任何文件。

使用此连接字符串

在此处输入图像描述

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;DefaultEndpointsProtocol=http;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
  }
}

它引发以下错误

[2022-05-26T21:44:56.133Z] An unhandled exception has occurred. Host is shutting down.
[2022-05-26T21:44:56.138Z] Azure.Storage.Blobs: The value for one of the HTTP headers is not in the correct format.
RequestId:4ddeb612-680e-40f0-8d62-ac754fe791e7
Time:2022-05-26T21:44:55.988Z
[2022-05-26T21:44:56.141Z] Status: 400 (The value for one of the HTTP headers is not in the correct format.)

它适用于 Azure 存储帐户连接字符串。 我在本地模拟器中缺少什么?

对于本地模拟器,您实际上并不需要“连接字符串”。 您可以将AzureWebJobsStorage设置为“UseDevelopmentStorage=true”。 这是我的 local.settings.json 的样子 -

{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet"
    }
}

参考: 使用 Azurite 模拟器进行本地 Azure 存储开发

暂无
暂无

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

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