GDI +中发生一般错误 - 仅在特定服务器上

时间:2016-05-16 06:03:26

标签: asp.net .net vb.net gdi+

我有以下代码将图像转换为字节数组以存储在数据库中。

Public Function Image2Bytes(ByRef aImage As Drawing.Image) As Byte()
    Dim MemStream As New MemoryStream()
    aImage.Save(MemStream, Drawing.Imaging.ImageFormat.Png)
    Return MemStream.ToArray()
End Function

这在我们的本地服务器以及一些生产服务器上运行良好。但是,在某些共享主机服务器上,这会产生GDI +错误,如下所述:

Error: Exception of type 'System.Web.HttpUnhandledException' was thrown. > A generic error occurred in GDI+.:

Top Stack Trace:

System.Web.UI.Page.HandleError(Exception e) 
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
System.Web.UI.Page.ProcessRequest() 
System.Web.UI.Page.ProcessRequest(HttpContext context) 
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Inner Stack Trace:

System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams) 
Common.Image2Bytes(Image& aImage) 
EntityClass.Validate() 
Logo.Page_Load(Object sender, EventArgs e) 
System.Web.UI.Control.OnLoad(EventArgs e) 
System.Web.UI.Control.LoadRecursive() 
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

我在这里看到了很多“Generic GDI +”错误,但没有一个能解决这个问题。对于每个解决方案,我需要上传到特定的生产服务器进行测试,因为本地没有错误。

有什么想法吗?

0 个答案:

没有答案