When I call Bitmap.Save
function, this error occurs: "A generic error occurred in GDI+". When I call from localhost it work, but when I call from another computer this error occurs.
Server Error in '/jobnumber' 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 b开发者_Go百科e 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) +377518 System.Drawing.Image.Save(String filename, ImageFormat format) +69 System.Drawing.Image.Save(String filename) +25 Assignment.CreateBitmapImage(String sImageText, Image Image1, JobInfo job_info_param) +124 Assignment.PrintButton_Click(Object sender, EventArgs e) +271 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
This is usually an indication the web user (IIS_USR for example) has no rights to save any data to the folder where you are saving the bitmap on the webserver.
I had similar problems before. Check the access rights on the server for that folder. Start out by giving everyone full access to that folder (just to make sure that is the problem) then narrow it down again so only the required user has access.
精彩评论