当使用HTTP触发器调用我的Azure函数时,我想从Blob存储中读取XML文件。我该怎么做?我看过很多不同的例子,但它们似乎都不适合我。函数在没有blob输入绑定的情况下工作正常,但我希望每次调用它时都从blob存储中读取文件。
我试过了:
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
[Blob("config/log4netConfig.xml", FileAccess.Read)] Stream configFile,
ILogger log)
{
XmlDocument doc = new XmlDocument();
using (XmlReader reader = XmlReader.Create(configFile))
{
doc.Load(reader);
}
在上面的代码中,vs2017无法理解blob属性,错误如下:
Error CS0246 The type or namespace name 'BlobAttribute' could not be found (are you missing a using directive or an assembly reference?)