httpTrigger中的Blob绑定在VS2017 Azure函数模板中不起作用 [英] Blob binding in httpTrigger not working in VS2017 Azure function template

查看:51
本文介绍了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.

这篇关于httpTrigger中的Blob绑定在VS2017 Azure函数模板中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆