[英]WebJob method NotSupportedException Saving Image to Azure Blob Storage
我正在尝试从WebJob BlobTrigger中保存缩略图,并且出现以下异常:
Microsoft.WindowsAzure.Storage.dll中发生类型'System.NotSupportedException'的异常,但未在用户代码中处理。其他信息:不支持指定的方法。
我已经将代码分解为最简单的元素,但仍然在位图上得到异常。
public static void CreateThumbnailsForNewlyUploadedPNGs([BlobTrigger("files/{name}.{ext}")] Stream input, [Blob("files/{name}~25.png", FileAccess.Write)] Stream output25, string name, string ext)
{
using (var bitmap = new Bitmap(input))
{
bitmap.Save(output25, ImageFormat.Png);
}
}
有什么建议可能出什么问题吗?
我对webjobs不太熟悉,但我看了您提到的文章并提出了一些建议。 我基本上将其尽可能地保留在Scotts的文章中。 我第二个参数的属性是BlobOutput而不是Blob。
public static void CreateThumbnailsForNewlyUploadedPNGs(
[BlobTrigger("files/{name}.{ext}")] Stream input,
[BlobOutput("files/{name}~25.png")] Stream output,
string name,
string ext)
{
using (var bitmap = new Bitmap(input))
{
bitmap.Save(output, ImageFormat.Png);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.