简体   繁体   English

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

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

I need to write an azure function that compress any files uploaded in the azure blob storage.我需要编写一个 azure 函数来压缩上传到 azure blob 存储中的任何文件。

With this Connection String使用此连接字符串

在此处输入图像描述

{
  "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"
  }
}

it throws the following error它引发以下错误

[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.)

It works fine with Azure Storage Account Connection string.它适用于 Azure 存储帐户连接字符串。 What am I missing in the local emulator?我在本地模拟器中缺少什么?

For the local emulator, you don't really require a "Connection String".对于本地模拟器,您实际上并不需要“连接字符串”。 You can set AzureWebJobsStorage to "UseDevelopmentStorage=true".您可以将AzureWebJobsStorage设置为“UseDevelopmentStorage=true”。 Here is how my local.settings.json look like -这是我的 local.settings.json 的样子 -

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

REFERENCES: Use Azurite emulator for local Azure Storage development参考: 使用 Azurite 模拟器进行本地 Azure 存储开发

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

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