尝试使用 Visual Studio 在 c# 中重新制作Azure Grid Image Resize示例,但在使事件网格触发 azure 函数触发器并绑定到 blob 存储时遇到问题。
当前代码:
using Microsoft.Azure.WebJobs.Extensions.EventGrid;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Azure.WebJobs;
using Microsoft.WindowsAzure.Storage.Blob;
namespace FunctionApp
{
public static class CreateIndex
{
[FunctionName("CreateIndex")]
[StorageAccount("backup_STORAGE")]
public static void Run(
[EventGridTrigger()] EventGridEvent myEvent,
[Blob("{data.url}")] CloudBlockBlob inputBlob,
TraceWriter log)
{
log.Info(myEvent.ToString());
log.Info(inputBlob.ToString());
}
}
}
生成的function.json:
{
"generatedBy": "Microsoft.NET.Sdk.Functions.Generator-1.0.6",
"configurationSource": "attributes",
"bindings": [
{
"type": "eventGridTrigger",
"name": "myEvent"
}
],
"disabled": false,
"scriptFile": "../bin/FunctionApp.dll",
"entryPoint": "FunctionApp.CreateIndex.Run"
}
绑定适用于事件网格触发器,但不适用于 Blob 输入。
预期的function.json:
{
"bindings": [
{
"type": "EventGridTrigger",
"name": "myEvent",
"direction": "in"
},
{
"type": "blob",
"name": "inputBlob",
"path": "{data.url}",
"connection": "myblobstorage_STORAGE",
"direction": "in"
}
],
"disabled": false
}