简体   繁体   中英

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.

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. 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". Here is how my local.settings.json look like -

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

REFERENCES: Use Azurite emulator for local Azure Storage development

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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