vb.net CLR 无法从 COM 上下文 0x22c4f60 转换到 COM 上下文 0x22c51b0 60 秒
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19585946/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The CLR has been unable to transition from COM context 0x22c4f60 to COM context 0x22c51b0 for 60 seconds
提问by w0051977
I am developing an application that calls a web service, which deletes information from a database (the web service was developed by a third party vendor). On the first run approximately 100,000 records are deleted.
我正在开发一个调用 Web 服务的应用程序,该服务从数据库中删除信息(该 Web 服务是由第三方供应商开发的)。在第一次运行时,大约会删除 100,000 条记录。
I have tested the routine a few times and this appears in Visual Studio occasionally:
我已经测试了几次例程,这偶尔会出现在 Visual Studio 中:
"The CLR has been unable to transition from COM context 0x22c4f60 to COM context 0x22c51b0 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations."
“CLR 无法在 60 秒内从 COM 上下文 0x22c4f60 转换到 COM 上下文 0x22c51b0。拥有目标上下文/单元的线程很可能正在执行非泵等待或处理很长时间运行的操作而不泵 Windows 消息。这种情况通常会对性能产生负面影响,甚至可能导致应用程序变得无响应或内存使用量随着时间的推移不断累积。为避免此问题,所有单线程单元 (STA) 线程都应使用泵等待原语(例如 CoWaitForMultipleHandles)和在长时间运行的操作中定期抽取消息。”
I assume that the web service is taking more than sixty seconds to pass control back to the .NET Forms app. Please see the following quote from the message: "To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations". As this is a Windows Forms app, does this mean that I do not need to do anything to allow for this?
我假设 Web 服务需要超过 60 秒才能将控制权传递回 .NET Forms 应用程序。请参阅消息中的以下引述:“为避免此问题,所有单线程单元 (STA) 线程应使用泵送等待原语(例如 CoWaitForMultipleHandles)并在长时间运行的操作期间定期泵送消息”。由于这是一个 Windows 窗体应用程序,这是否意味着我不需要做任何事情来允许这样做?
回答by TAUFEEQ ATTAR
Sometimes this issue may also occur due to wrong server name, like if you had included SERVER/SQLEXPRESSinstead of SERVER\SQLEXPRESSthen also this error displays, which was my case.
有时这个问题也可能是由于错误的服务器名称而发生的,比如如果你包含SERVER/SQLEXPRESS而不是SERVER\SQLEXPRESS这个错误也会显示,这就是我的情况。
回答by Nygons
Check and be sure if you are using a reader that you do not included try/catches. You should make and effort to try and resolve your solution issue better than that. A try/catch will cause a time out especially in a while loop.
检查并确定您使用的阅读器是否未包含 try/catchs。您应该努力尝试更好地解决您的解决方案问题。try/catch 会导致超时,尤其是在 while 循环中。

