Dan*_*ley 15 .net iis wpf rendering system.windows.media
使用案例:我正在使用WPF在Web上下文中动态覆盖图像上的文本.
解决方案:我使用的是DrawingContext从DrawingVisual(包裹在一个using声明中)来绘制原始位和覆盖文本.
问题:在几千个请求之后,该[DrawingVisual].RenderOpen()方法开始拒绝执行并抛出以下异常:
The system cannot find the file specified System.ComponentModel.Win32Exception UInt16 RegisterClassEx(WNDCLASSEX_D) at MS.Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D wc_d)
at MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent, HwndWrapperHook[] hooks)
at System.Windows.Media.MediaContextNotificationWindow..ctor(MediaContext ownerMediaContext)
at System.Windows.Media.MediaContext..ctor(Dispatcher dispatcher)
at System.Windows.Media.MediaContext.From(Dispatcher dispatcher)
at System.Windows.Media.Visual.VerifyAPIReadWrite()
at System.Windows.Media.DrawingVisual.RenderOpen()
at ...
Run Code Online (Sandbox Code Playgroud)
临时修复:唯一的解决方法是在服务器上回收IIS应用程序池,将问题解决几个小时.
问题:任何人都想过这个问题的原因(泄漏,线程,非托管代码等)?有没有其他方法可以在图像上获取文本,避免绘图视觉?也许将几何图形写入位图并直接覆盖位图?
| 归档时间: |
|
| 查看次数: |
1170 次 |
| 最近记录: |