I received the foolowing message when attempting to upload a message. I do not have any .Net experience. Is there anyone out there that will take the time to give me a hand with this .Net error message? This appears to be a really nice looking and funtional
image gallery and I would really enjoy using for family photos. Jimmy......................................................... A generic error occurred in GDI+. Description: An unhandled exception occurred during the execution of the current web request. Please
review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. Source Error: An unhandled exception was generated during
the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: --------------------------------------------------------------------------------
[ExternalException (0x80004005): A generic error occurred in GDI+.] System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) +582 nGallery.Lib.PhotoCache.GetScaledPicture() +1747 nGallery.Lib.PhotoCache.GetThumbnail()
+66 nGallery.admin.addPicture.btnSubmit_ServerClick(Object sender, EventArgs e) +651 System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e) +108 System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1277 --------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
I've found more information regarding this error. It has seen some trouble in other applications. This knowledge base article describes the problem:
http://support.microsoft.com/?id=814675 Now the question is, what is the solution for nGallery? On a separate note, if this problem exists and is known for GDI+, how come other users don't experience this
problem? Is it really just a permissions issue and not related to the aforementioned KB Article? FYI, I experience this problem after a clean install of the gallery. The Check Permissions function returns all PASSED results.
Okay. So apparently it is just a regular permissions issue.
This article describes what one should do. Note, when one mentions the "ASP Worker Process", this is the ASPNET account (at least for me). Giving this account full control access on the data, upload, and photo directories fixed the problem.
This error is a common one and also very tricky. The error itself is not very descriptive. Permission problems is the common cause, but there have been some cases where the permissions are fine and it still happens. I've seen some articles on this error, but
the same error message is shown for completely different causes. We've seen it for permissions to the photos directory, permissions to the IIS temporary directory, and even more random stuff. The first link you posted is most likely not the cause. It is talking
about errors when constructing the image and disposing the image, not when it is saving it. Also, at the buttom it says it applies to .NET 1.0, doesn't mention .NET 1.1. Glad you got the problem taken care of! Sorry for the slow response, wasn't around too
much with the 4th of July weekend.
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. WHEN YOU TRY TO SAVE A BITMAP
you can not save the same Bitmap whihch you loaded into the object as it is bieng used by the other process at the same time....
So first rename it and then try to save....
//Step 6 : Try to save the image
// this file is exclusively locked by BITMAP process so PERHAPS error may occur so first prefix the s_ before image
//Now save this image
ObjBitmap.Save(TargetPath + "s_" + tmpFileName, System.Drawing.Imaging.ImageFormat.Jpeg);
//STEP 7 : CLEAN UP
//Destroy the Graphics Object
ObjGraphics.Dispose();
//DESTROY thE Bitmap Object and UNLOCK the file
ObjBitmap.Dispose();
I know its very old post. I am just posting due to the reason if some one will search this error & ma get solution.
I was also facing same error, i did lots of R&D. Actually i was saving files in a temporary folder after uploading. After that i was performing some operations on the image and saving resultant image in a different folder and deleting file in temporary folder.
Actually temporary folder is empty, after publishing , that temporary folder does not exist in published project. so, for saving file temporarily, it is not getting path.
then i have manually created empty temporary folder in published folder.
its working f9 now.
Remember to click “Mark as Answer” on the post, if it helps you. Because It helps others to find the solution.
jimmyLeander
Member
15 Points
3 Posts
A generic error occurred in GDI+
Jul 04, 2004 09:50 PM|LINK
jaraco
Member
15 Points
3 Posts
Re: A generic error occurred in GDI+
Jul 06, 2004 11:29 AM|LINK
jaraco
Member
15 Points
3 Posts
Re: A generic error occurred in GDI+
Jul 06, 2004 11:45 AM|LINK
qgyen
Participant
1967 Points
396 Posts
Re: A generic error occurred in GDI+
Jul 06, 2004 05:35 PM|LINK
shantanushuk...
Member
475 Points
152 Posts
Re: A generic error occurred in GDI+
Nov 19, 2007 01:42 PM|LINK
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. WHEN YOU TRY TO SAVE A BITMAP
you can not save the same Bitmap whihch you loaded into the object as it is bieng used by the other process at the same time....
So first rename it and then try to save....
//Step 6 : Try to save the image // this file is exclusively locked by BITMAP process so PERHAPS error may occur so first prefix the s_ before image //Now save this image ObjBitmap.Save(TargetPath + "s_" + tmpFileName, System.Drawing.Imaging.ImageFormat.Jpeg); //STEP 7 : CLEAN UP //Destroy the Graphics Object ObjGraphics.Dispose();//DESTROY thE Bitmap Object and UNLOCK the file ObjBitmap.Dispose();System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
http://www.linkedin.com/in/shantanushukla
liammclennan
Member
478 Points
105 Posts
Re: A generic error occurred in GDI+
Apr 30, 2008 03:37 AM|LINK
If this error is caused by permissions then there are two possible scenarios:
Eclipse Web Solutions
liam@eclipsewebsolutions.com.au
http://www.eclipsewebsolutions.com.au
radok
Member
2 Points
1 Post
Re: A generic error occurred in GDI+
Jan 14, 2009 09:18 AM|LINK
Hi there,
i did all solution but never solve this problem.
i gave full permission folder and dispose() all bitmap and grabhics. its nothing.
But i try this one : GC.Collect(); and its working. i think iis working process cannot permission overwrite same bitmap. Because of bitmaps lifetime.
So i use Garbace Collector and solve this problem. My code is working fine.
Regards,
MinaSamy
Member
237 Points
172 Posts
Re: A generic error occurred in GDI+
Feb 01, 2009 09:46 AM|LINK
thanks man that worked
--------------------------------------------------
http://www.learn-mvc.blogspot.com
dacraka
Member
4 Points
2 Posts
Re: A generic error occurred in GDI+
Sep 10, 2009 08:46 PM|LINK
Yea, just needed to do a .Dispose(); when done with the first System.Drawing.Image
rajeev16mca2...
Member
292 Points
91 Posts
Re: A generic error occurred in GDI+
Oct 09, 2009 05:28 AM|LINK
I know its very old post. I am just posting due to the reason if some one will search this error & ma get solution.
I was also facing same error, i did lots of R&D. Actually i was saving files in a temporary folder after uploading. After that i was performing some operations on the image and saving resultant image in a different folder and deleting file in temporary folder.
Actually temporary folder is empty, after publishing , that temporary folder does not exist in published project. so, for saving file temporarily, it is not getting path.
then i have manually created empty temporary folder in published folder.
its working f9 now.
Rajeev Singh Chib
+91-9899816577, +91-9906297214
rajeev16mca2k5@gmail.com