I have some code that saves a jpg image, which works fine locally, but when I publish to discountasp.net, I get the following error when my site tries to save the image. It's being saved to a folder within my project. Has anyone else had trouble saving jpg files programmatically? Thanks in advance! Code: Server Error in '/' Application. 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) +461268 ImageResize.ImageToResize.SaveJpeg(String path, Int64 quality) in C:\Users\Brad\documents\visual studio 2010\Projects\LuAnnRohrerPhotography\ImageResize\ImageToResize.cs:35 RohrerPhotography.Models.Photo.CreateThumbnailImage(String path) in C:\Users\Brad\documents\visual studio 2010\Projects\LuAnnRohrerPhotography\RohrerPhotography\Models\Photo.cs:42 RohrerPhotography.Controllers.AdminController.Create(Photo photo, HttpPostedFileBase uploadPhoto) in C:\Users\Brad\documents\visual studio 2010\Projects\LuAnnRohrerPhotography\RohrerPhotography\Controllers\AdminController.cs:103 lambda_method(Closure , ControllerBase , Object[] ) +157 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +199 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27 System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +56 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +267 System.Web.Mvc.<>c__DisplayClassf.<InvokeActionMethodWithFilters>b__c() +20 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +190 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +345 System.Web.Mvc.Controller.ExecuteCore() +115 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +42 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +34 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +43 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841105 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Ummm, nevermind. It's because VS never published the empty directory that I created to store my images, so the save-to path was invalid. I put a dummy file in my save-to directory, which forced VS to publish the folder, now all is well. Didn't know VS wouldn't publish an empty folder.