windbg 解决 "System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool." 过程中碰见的问题

 
 
使用windbg可以调试asp.net中数据库连接池是否超限的问题。详见文章:
 
我主要其实想说明的是,在搭建调试环境和进行调试过程中可能碰到的几个问题:
1. The call to LoadLibrary(C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll) failed
0:000> .load C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
The call to LoadLibrary(C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll) failed, Win32 error 0n193
    "%1 is not a valid Win32 application."
Please check your debugger configuration and/or network access.
A:检查你的windbg版本,是否为x86,估计你现在用的是x64,你想导入x86的clr.dll肯定出错了...换个windbg或者导入:
.load C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
2. Failed to find runtime DLL (clr.dll), 0x80004005
0:000> !dumpheap
Failed to find runtime DLL (clr.dll), 0x80004005
Extension commands need clr.dll in order to have something to do.
A:请先用.chain命令查看是否已经导入clr扩展:
0:000> .chain
Extension DLL search Path:
    ...//省略
Extension DLL chain:
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll: image 4.0.30319.239, built Sat Jul 09 17:44:20 2011
        [path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll]
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SOS.dll: image 4.0.30319.239, API 1.0.0, built Sat Jul 09 18:00:43 2011
        [path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SOS.dll]
    dbghelp: image 6.12.0002.633, API 6.1.6, built Tue Feb 02 04:15:44 2010
        [path: D:\WinDDK\7600.16385.1\Debuggers\dbghelp.dll]
    ext: image 6.12.0002.633, API 1.0.0, built Tue Feb 02 04:15:46 2010
        [path: D:\WinDDK\7600.16385.1\Debuggers\winext\ext.dll]
    exts: image 6.12.0002.633, API 1.0.0, built Tue Feb 02 04:15:38 2010
        [path: D:\WinDDK\7600.16385.1\Debuggers\WINXP\exts.dll]
    uext: image 6.12.0002.633, API 1.0.0, built Tue Feb 02 04:15:36 2010
        [path: D:\WinDDK\7600.16385.1\Debuggers\winext\uext.dll]
    ntsdexts: image 6.1.7650.0, API 1.0.0, built Tue Feb 02 04:15:18 2010
        [path: D:\WinDDK\7600.16385.1\Debuggers\WINXP\ntsdexts.dll]
如果已经导入了clr.dll,但是还是不行,那么估计你调试的是一个dump文件或者程序已经跑完。建议在程序即将结束处加个sleep,让程序等待在那里,并且通过Open Excutable...的方式打开程序后,按g让程序先跑起来,等挂起的时候,再按CTRL+BREAK,让程序暂停,这个时候再倒入sos和clr扩展。现在再输入!dumpheap应该就可以了。(参考:http://social.msdn.microsoft.com/Forums/en-US/clr/thread/59aa78c9-dc05-43c8-9efe-e7b132056afc/)
 
posted @ 2012-08-28 14:33  赤脚的懒虫  阅读(5846)  评论(0编辑  收藏  举报