GDI+ System.Drawing.Bitmap gives error Parameter is not valid intermittently

前端 未结 6 553
抹茶落季
抹茶落季 2021-02-05 16:23

I have some C# code in an ASP.Net application that does this:

Bitmap bmp = new Bitmap(1184, 1900);

And occasionally it throws an exception \"Parameter is not val

6条回答
  •  深忆病人
    2021-02-05 16:53

    I just got a reply from microsoft support. Apparently if you look here:

    http://msdn.microsoft.com/en-us/library/system.drawing.aspx

    You can see it says "Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions." So they're basically washing their hands of the issue. It appears that they're admitting that this section of the .Net framework is unreliable. I'm a bit disappointed.

    Next up - can anyone recommend a similar library to open a gif file, superimpose some text, and save it again?

提交回复
热议问题