在调试器中执行webmethod时应用程序挂起 [英] application hangs when executing webmethod inside debugger

查看:68
本文介绍了在调试器中执行webmethod时应用程序挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个使用C#Web服务的Win32混合模式MFC应用程序。所有应用程序都是用.Net 1.1(Visual Studio 2003)编写的,虽然我在同一台PC上安装了框架2.0和Visual Studio 2005.

我目前使用的代码是我们之前版本的结果,它是工作正常,直到前一段时间。但是自从我重新开始处理该代码以来,只要执行Web Service方法,应用程序就会挂起。所有的Web服务方法都在一个单独的线程中执行,我注意到如果我只是运行线程体(没有威胁),它工作正常(但我不能这样做)。此外,如果应用程序从调试器外部运行,一切正常,这清楚地表明这是一个调试器问题。

如果我按下调试工具栏按钮中的暂停按钮并转到调用堆栈窗口,这就是我所看到的:

------------------------------- ----------- system.web.services.dll!System.Web.Services.UnsafeNativeMethods.RegisterNotifySource(System.Web.Services.Interop.INotifyConnection2 connection = {System .__ ComObject},System.Web.Services.Interop.INotifySource2 source = {System.Web.Services.Protocols.RemoteDebugger})+ 0x1e bytes
system.web.services.dll!System.Web.Services.Protocols .RemoteDebugger.get_NotifySink()+ 0x2d bytes
system.web.services.dll!System.Web.Services.Protocols.RemoteDebugger.NotifyClientCallOut(System.Net.WebRequest request = {System.Net.HttpWebRequest})+ 0x3d bytes
system.web.services.dll!System.Web.Services.Protocols.WebClient Protocol.GetWebRequest(System.Uri uri = {System.Uri})+ 0xdd bytes
system.web.services.dll!System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(System.Uri uri = {System.Uri })+ 0x22字节
system.web.services.dll!System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(System.Uri uri = {System.Uri})+ 0x1b bytes
system.web.services .dll!System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(string methodName =" AskChallenge",System.Object [] parameters = {Length = 0})+ 0x75 bytes
> Medigraf.exe!SQLService.Service1.AskChallenge()第429行+ 0x1d字节C ++
Medigraf.exe!CSQLServiceProxy :: _ ThreadConnect(void * lparam = 0x068a2918)第717行+ 0x20字节C ++

--- ---------------------------------------

Call堆栈中的第一行让我相信调试器正在尝试调试Web服务(位于远程PC中)。我没有兴趣调试Web服务,至少不是来自调试器的同一个实例。

有人可以帮我这个吗?我不知道接下来要做什么来解决它。

Pena

Hi,

I have a Win32 Mixed mode MFC application which uses C# web services. All applications are written in .Net 1.1 (Visual Studio 2003) although I have framework 2.0 and Visual Studio 2005 installed on the same PC.

The code I'm currently using is result of our previous version and it was working fine until some time ago. But ever since I restarted working on that code, the application simply hangs up whenever a Web Service method is executed. All web service methods are executed in a separate thread and I've noticed that if I simply run the thread body (without the threat), it works fine (but I cannot do that). Moreover, everything works fine if the application is run from outside the debugger, which makes it clear that this is a debugger issue.

If I press the pause button in the debug toolbar button and goto to the call stack window, this is what I see:

------------------------------------------ system.web.services.dll!System.Web.Services.UnsafeNativeMethods.RegisterNotifySource(System.Web.Services.Interop.INotifyConnection2 connection = {System.__ComObject}, System.Web.Services.Interop.INotifySource2 source = {System.Web.Services.Protocols.RemoteDebugger}) + 0x1e bytes   
     system.web.services.dll!System.Web.Services.Protocols.RemoteDebugger.get_NotifySink() + 0x2d bytes   
     system.web.services.dll!System.Web.Services.Protocols.RemoteDebugger.NotifyClientCallOut(System.Net.WebRequest request = {System.Net.HttpWebRequest}) + 0x3d bytes   
     system.web.services.dll!System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(System.Uri uri = {System.Uri}) + 0xdd bytes   
     system.web.services.dll!System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(System.Uri uri = {System.Uri}) + 0x22 bytes   
     system.web.services.dll!System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(System.Uri uri = {System.Uri}) + 0x1b bytes   
     system.web.services.dll!System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(string methodName = "AskChallenge", System.Object[] parameters = {Length=0}) + 0x75 bytes   
>    Medigraf.exe!SQLService.Service1.AskChallenge() Line 429 + 0x1d bytes    C++
     Medigraf.exe!CSQLServiceProxy::_ThreadConnect(void* lparam = 0x068a2918) Line 717 + 0x20 bytes    C++

------------------------------------------

The first lines in the Call stack lead me to believe that the debugger is trying to debug the web service (which is in a remote PC). I have no interest on debugging the web service, at least not from the same instance of the debugger.

Can somebody please help me with this? I have no idea of what to do next to fix it.

Pena

推荐答案

我知道这是一个老问题,但我在这里添加我的解决方案。

如果您有访问权限 - 请检查Web服务器日志。我的问题是后台线程中的一个错误,它产生了太多的线程 - 每个线程都创建了另一个与Web服务器的连接。由于HTTP仅支持一定数量的连接,因此.Net CF只会挂起对"System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke"的调用。 - 没有超时错误,没有 - 只是坐下等待新的连接(或者至少对我来说似乎 - 这可能是我生产了很多线程的事实!)
I know this is an old problem but though I'd add my solution here.

If you have access - check the web server logs. My problem was a bug in a background thread that was spawning too many threads - each of which creating another connection to the web server. As HTTP only supports a certain number of connections, the .Net CF just hangs on the call to "System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke" - no timeout error, nothing - just sits and waits for a new connection (or at least it seems to for me - this could be the fact that I had a lot of threads spawning, though!)


这篇关于在调试器中执行webmethod时应用程序挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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