[英]WebJob method NotSupportedException Saving Image to Azure Blob Storage
I am trying to save a thumbnail from within a WebJob BlobTrigger and I am getting the following Exception: 我正在尝试从WebJob BlobTrigger中保存缩略图,并且出现以下异常:
An exception of type 'System.NotSupportedException' occurred in Microsoft.WindowsAzure.Storage.dll but was not handled in user code Additional information: Specified method is not supported. Microsoft.WindowsAzure.Storage.dll中发生类型'System.NotSupportedException'的异常,但未在用户代码中处理。其他信息:不支持指定的方法。
I have broken the code down to its simplest elements and still get the exception on bitmap.Save 我已经将代码分解为最简单的元素,但仍然在位图上得到异常。
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);
}
}
Any suggestions what might be going wrong? 有什么建议可能出什么问题吗?
I'm not too familiar with webjobs but I looked at the article you mentioned and came up with something. 我对webjobs不太熟悉,但我看了您提到的文章并提出了一些建议。 I basically kept it as close to Scotts article as I could. 我基本上将其尽可能地保留在Scotts的文章中。 My attribute for the second parameter is BlobOutput instead of Blob. 我第二个参数的属性是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.