System.Windows.Media.DrawingVisual.RenderOpen()经过一段时间示数 [英] System.Windows.Media.DrawingVisual.RenderOpen() erroring after a time

查看:785
本文介绍了System.Windows.Media.DrawingVisual.RenderOpen()经过一段时间示数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用案例:我使用WPF到网络环境中的动态图像叠加文本。

Use Case: I'm using WPF to dynamically overlay text on images within a web context.

解决方案: 我使用的是的DrawingContext DrawingVisual (包裹在一个使用语句)来绘制原始位图和覆盖文本。

Solution: I'm using a DrawingContext from a DrawingVisual (wrapped in a using statement) to draw the original bitmap and overlay text.

问题:后几千要求 [DrawingVisual] .RenderOpen()方法开始拒不执行,并抛出以下异常:

Problem: After a few thousand requests the [DrawingVisual].RenderOpen() method starts refusing to execute and throws the following exception:

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 ...

温度修正:对这个问题的唯一解决方法是回收IIS应用程序池这解决了这个问题了几个小时在服务器上

Temp fix: The only fix for this is to recycle the IIS application pool on the server which fixes the problem for a few hours.

问:任何人都有一个想法对这一问题的原因(泄漏,线程,非托管code等)?是否有图像避免绘图视觉上获取文本的任何其他方式?也许写的几何形状为位图,直接覆盖了位图?

Question: Anyone have a thought on the cause of this issue (leaks, threading, unmanaged code etc)? Is there any other way of getting text on an image avoiding the drawing visual? Perhaps writing geometry to a bitmap and overlaying the bitmaps directly?

推荐答案

这是一个古老的补丁 - 我本来以为这是包含在.NET 4.x的 - 但我不那么肯定。反正 - 你可以给它一个镜头。

This is an old patch - and I would have assumed it was included in .NET 4.x - but I'm not so sure. Anyways - You can give it a shot.

资讯&raquo; <一href="http://connect.microsoft.com/VisualStudio/feedback/details/361469/net-3-5-sp1-breaks-use-of-wpf-under-iis"相对=nofollow>讨论及错误报告

» Discussion & Bug Report

资讯&raquo; .NET补丁(86)

».NET Patch(x86)

这篇关于System.Windows.Media.DrawingVisual.RenderOpen()经过一段时间示数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆