asp.net - System.Drawing:GDI+ 未正确初始化(​内部 GDI+ 错误​)

标签 asp.net iis gdi+ system.drawing

ASP.NET 网站随机引发此 System.Drawing-error:

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 Framework 错误(我实际上并没有尝试创建任何图像)。

我找到了一个临时解决方案:重新启动 IIS 并删除临时 ASP.NET 文件(“%WINDIR%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files”)。 但是当这个错误发生在生产网络服务器中时,临时是不够的......

最佳答案

巧合的是,今天我们的一台服务器上有这个。这是 ASP.NET 中的一个已知问题,在 http://support.microsoft.com/kb/975410 上有一个修复程序。 .

关于asp.net - System.Drawing:GDI+ 未正确初始化(​内部 GDI+ 错误​),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1826718/

相关文章:

javascript - CKEditor 的配置文件没有任何效果

c# - 访问代码隐藏中动态创建的 HiddenField 值

windows - 使用 powershell 更改 IIS SSL 设置

asp.net - 如何在工作日的特定时间回收应用程序池?

asp.net - 在 IIS7 中访问图像时出现 500 内部服务器错误

c++ - 如何通过指针获取构造函数内部函数返回值的地址

javascript - 可滚动 GridView 不能与 ASP.Net 中的 UpdatePanel 一起使用

.net - ErrorMessage 样式化 ASP.NET

c++ - VC++ 10.0 express gdi+ GdiPlusPen.h 头文件

c++ - D3D11 : How to draw GDI Text to a GXDI Surface?(无 D2D)