A generic error occurred in GDI+

Sep 26, 2011 at 7:45 PM

Hi, 

Did you have problems with this when uploading the live demo? Basically, image functions work fine for me in IIS Express/Locally. When I publish my project to a remote IIS I get the following error.

<error errorId="db138bcb-49a1-4872-9b54-f8604a240d0d" host="DEVEL-WEB" type="System.Runtime.InteropServices.ExternalException" message="A generic error occurred in GDI+." source="System.Drawing" detail="System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.&#xD;&#xA;   at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)&#xD;&#xA;   at Omu.ACIM.Service.FileManagerService.SaveTempJpeg(Stream inputStream, Int32&amp; w, Int32&amp; h) in C:\dev\ACIM\ACIM\Service\FileManagerService.cs:line 45&#xD;&#xA;   at Omu.ACIM.WebUI.Controllers.ParticipantController.Upload(HttpPostedFileBase file) in C:\dev\ACIM\ACIM\WebUI\Controllers\ParticipantController.cs:line 44&#xD;&#xA;   at lambda_method(Closure , ControllerBase , Object[] )&#xD;&#xA;   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)&#xD;&#xA;   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)&#xD;&#xA;   at System.Web.Mvc.ControllerActionInvoker.&lt;&gt;c__DisplayClass15.&lt;InvokeActionMethodWithFilters&gt;b__12()&#xD;&#xA;   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)&#xD;&#xA;   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)&#xD;&#xA;   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)&#xD;&#xA;   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)&#xD;&#xA;   at System.Web.Mvc.Controller.ExecuteCore()&#xD;&#xA;   at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)&#xD;&#xA;   at System.Web.Mvc.MvcHandler.&lt;&gt;c__DisplayClass6.&lt;&gt;c__DisplayClassb.&lt;BeginProcessRequest&gt;b__5()&#xD;&#xA;   at System.Web.Mvc.Async.AsyncResultWrapper.&lt;&gt;c__DisplayClass1.&lt;MakeVoidDelegate&gt;b__0()&#xD;&#xA;   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()&#xD;&#xA;   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)" time="2011-09-26T18:35:58.0832083Z">

Sep 26, 2011 at 8:03 PM

Hardcoded path in Web.config is the culprit if anyone else experiences this.

 

under appSettings node look for <add key="storagePath" value="" />   <--- this was a hardcoded value

Coordinator
Sep 26, 2011 at 9:16 PM

I wrote about this in the readme

Sep 27, 2011 at 1:20 AM

Neat, I somehow missed that, sorry about this.

The only thing I would add is that I resolved the permissions issue by enabling modify access on the ApplicationPool instead of the IIS_USERS. (dont know if this makes a difference)

Also, I had to give modify access to the "logs" folder in addition to the pictures folder , because my application was unable to write error logs to the folder without that level of access.


Thanks