tags:

views:

158

answers:

4

A generic error occurred in GDI+

[ExternalException (0x80004005): A generic error occurred in GDI+.] System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams) +615257

I have a webpage in which a pdf is converted to png, and using the response.outputstream it is displayed. when i run this on my local machine is works fine. but when i run the same code on server is throws this exception.

my question is , where i could look in for error. as there is no inner exception or any other information provided. only clue is that it's happening on Image.Save , but the same code works perfectly fine on my local machine , then y is it not working on production???

http://blog.maartenballiauw.be/post/2008/05/13/ASPNET-MVC-custom-ActionResult.aspx

this is the example i am following

A: 

Take a look at the big "Caution" note in the System.Drawing documentation. All kinds of weird stuff can happen when you use something intended for desktop processing in a service process.

Check the usuals like permissions, path existence, framework version, etc.

StingyJack
A: 

I had something similar a while back ... usually to do with security. Don't copy the png over from dev, (if you have one) the server probably won't be able to overwrite and make sure the asp proccess has write access to the dir you're attempting to save to.

PaulB
A: 

It is probably that the asp.net worker process does not have permision to create a file where you are trying to save the image on the server.

Ben Robinson
Image.Save(context.HttpContext.Response.OutputStream, ImageFormat);this is what i am doing writing the to the output stream.
Pinu
A: 

I changed my Image over load method to

Image.Save(context.HttpContext.Response.OutputStream, ImageCodecInfo encoder, EncoderParameters encoderParams)

earlier i was using Image.Save(context.HttpContext.Response.OutputStream,ImageFormat)

after changing the overload method for save , it fixed the error.

Pinu