2009-12-01 64 views
3

ASP.NET網站隨機引發此System.Drawing中錯誤:System.Drawing中:GDI +不正確初始化(內部GDI +錯誤)

System.Runtime.InteropServices.ExternalException:System.Drawing中。 Bitmap..ctor(流流) 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.TypeDescriptor.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) 

爲什麼?我認爲這是一個.NET框架錯誤(我實際上沒有嘗試創建任何圖像)。

我發現了一個臨時解決方案:重新啓動IIS並刪除臨時ASP.NET文件(「%WINDIR%\ Microsoft.NET \ Framework \ v2.0.50727 \ Temporary ASP.NET Files」)。 但是,當這個錯誤發生在生產網絡服務器時,臨時是不夠的...

+0

一個東西,它使事情更難在IIS錯誤消息的定位。谷歌搜索「GDI +:aa ei ole alustettu oikein(sisäinenGDI + -virhe)」並不是非常有用。 : -/ – 2009-12-01 15:03:21

回答

7

巧合的是,我們今天在我們的一臺服務器上有這個。這是ASP.NET中的一個已知問題,在http://support.microsoft.com/kb/975410處有一個修補程序。

+0

嗨!謝謝回覆。我最近沒有看到這個錯誤,所以我接受這個答案。 – 2010-02-04 14:47:21

1

更改此設置真正在固定它爲我的web.config:

<validation validateIntegratedModeConfiguration="true" />