开发者

System.Drawing: GDI+ is not properly initialized (​internal GDI+ error​)

开发者 https://www.devze.com 2022-12-12 19:35 出处:网络
An ASP.NET Web Site raises randomly this System.Drawing-error: System.Runtime.InteropServices.ExternalException: System.Drawing.Bitmap..ctor(Stream stream)

An ASP.NET Web Site raises randomly this System.Drawing-error:

System.Runtime.InteropServices.ExternalException: System.Drawing.Bitmap..ctor(Stream stream) System.Drawing.ToolboxBitmapAttribute..cctor()

Exception information: 
    Exception type: TypeInitializationException 
    Exception message: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception. 

Stack trace:    at System.Reflection.CustomAttribute._CreateCaObject(Void* pModule, Void* pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
   at System.Reflection.CustomAttribute.CreateCaObject(Module module, RuntimeMethodHandle ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
   at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
   at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)
   at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectGetAttributes(Type type)
   at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectedTypeData.GetAttributes()
   at System.ComponentModel.TypeDescr开发者_JAVA百科iptor.TypeDescriptionNode.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetAttributes()
   at System.ComponentModel.TypeDescriptor.GetAttributes(Type componentType)
   at System.Web.UI.ThemeableAttribute.IsTypeThemeable(Type type)
   at System.Web.UI.Control.ApplySkin(Page page)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Why? I think that this is a .NET Framework error (I'm actually not trying to create any images).

I found a temporary solution: restart IIS and delete Temporary ASP.NET Files ("%WINDIR%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files"). But when this error happens in the production web-server, temporary is not enough...


By coincidence we've had this on one of our servers today. It's a known issue in ASP.NET, there's a hotfix for it at http://support.microsoft.com/kb/975410.


Changing this setting to true in the web.config fixed it for me:

<validation validateIntegratedModeConfiguration="true" />
0

精彩评论

暂无评论...
验证码 换一张
取 消