简体   繁体   English

WebJob方法NotSupportedException将图像保存到Azure Blob存储

[英]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.

相关问题 为什么我的 azure webjob 没有登录到存储 blob? - why is my azure webjob not logging to the storage blob? 将MemoryStream保存到Azure Blob存储 - Saving a MemoryStream to Azure blob storage 将图像上传到Azure Blob存储 - uploading image to azure blob storage 如何使用Azure WebJob将文件上载到Azure Blob存储? (使用C#,.NET) - How to upload files to Azure Blob Storage using Azure WebJob? (Using C#, .NET) 使用 C# 的 Azure Blob 存储“找不到方法” - Azure Blob Storage "Method not found" with C# 如何从Azure Blob存储访问图像 - How to access an image from azure blob storage 从URL将图像上传到Azure Blob存储 - Upload image to Azure Blob Storage from URL Webjob V3 未启动:找不到方法:'Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer - Webjob V3 not starting: Method not found: 'Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer 为什么 Azure WebJob 无法连接到 Azure SQL,提示“存储帐户的类型不受支持的‘Blob-Only/ZRS’。支持的类型是‘通用’? - Why Azure WebJob cannot connect to Azure SQL saying "Storage account is of unsupported type 'Blob-Only/ZRS'. Supported types are 'General Purpose'? Azure WebJob和实例异步方法 - Azure WebJob and instance async method
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM