httpTrigger中的Blob绑定在VS2017 Azure函数模板中不起作用
问题描述:
我想通过如下所示的get请求将blob的文件名传递给httptrigger.
I want to pass the filename of blob to the httptrigger, through get request as below.
http://localhost:7071/api/CSVDataMigrationHttpTrigger/testdata.csv
天蓝色函数的代码
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "CSVDataMigrationHttpTrigger/{name}")]
HttpRequest req, string name,
[Blob("csvdata-upload/{name}", FileAccess.Read, Connection = "AzureWebJobsStorage")]
Stream inputBlob, ILogger log)
{}
inputBlob参数未解析,它返回null.
但是,如果我在Blob参数中将文件名指定为"testData.csv",则inputBlob会得到正确解析.
But if i give filename as "testData.csv" as below in the Blob parameter, then inputBlob get resolved properly.
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "CSVDataMigrationHttpTrigger/{name}")]
HttpRequest req, string name,
[Blob("csvdata-upload/testData.csv", FileAccess.Read, Connection = "AzureWebJobsStorage")]
Stream inputBlob, ILogger log){}
答
我终于发现,传递给blob时,文件名区分大小写.希望它能对遇到同样问题的任何人有所帮助.
I found out finally, the filename was case sensitive, when passed to blob. Hope it helps anyone who has the same issue.