使用 adplus.vbs 捕获转储 - 等待调试器完成?
我有一个网络应用程序,有时会挂起。我想调查原因,并且需要在进程挂起时获取该进程的内存转储。
所以我的想法是监视网站,当我检测到挂起时,我想启动一个 .bat 脚本来捕获内存转储,然后运行 IISRESET 以便重新启动,以便网站再次开始响应。
我的问题是,adplus 启动另一个进程(cdb.exe)并立即返回。我需要等待 cdb.exe 完成,然后才能运行 IISRESET。有没有办法在批处理脚本中做到这一点?或者,我可以在 adplus 命令行上指定它在收集内存转储之前不应返回吗?
I have a web application, that sometimes hangs. I want to investigate the reason, and I need to get a memory dump of the process, when it hangs.
So my idea is to monitor the website, when I am detecting the hang, I want to start a .bat script which captures the memory dump, then runs IISRESET in order to restart so that the site will start responding again.
My problem is, that adplus starts another process (cdb.exe) and returns immediately. I need to wait for cdb.exe to finish, before I can run IISRESET. Is there any way to do that in a batch script ? Or, can I specify on the adplus command line, that it should not return until the memory dump has been collected ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
关于你的问题的第二部分,答案是肯定的:你可以(1)在命令行上指定等待(只要你可以访问和修改它); (2) 等待批处理文件中的进程完成。
最简单的形式是,
(1) 使用
START /WAIT cdb parms
而不仅仅是cdb parms
(2) 尝试
FOR /F "tokens=1,2 " %a in ('TASKLIST ^| FIND /I "cdb.exe"') DO @ECHO %a %b
并将 ECHO 替换为您想要的命令。Regarding the second part of your question, the answer is yes: you can both (1)specify the wait on the commmand line (as long as you can access to and modify it); and (2)wait for a process to finish in a batch file.
In their simplest form, do
(1) use
START /WAIT cdb parms
instead of justcdb parms
(2) try
FOR /F "tokens=1,2" %a in ('TASKLIST ^| FIND /I "cdb.exe"') DO @ECHO %a %b
and substitute ECHO for the command you want.要创建 Web 应用程序的内存转储,Microsoft 调试诊断工具是您的最佳选择。
您可以创建“IIS 挂起”规则,监视特定 URL,并在指定秒数内未收到响应时创建内存转储。
调试诊断工具不会帮助您重新启动 IIS(或您的应用程序池),但一般来说,内置应用程序池重新启动选项应该足够了。如果您确保为您的 AppPool 设置了“启用 Pinging”(在其“运行状况”选项卡上),并且还适当地设置了其他运行状况/回收参数,则无论发生什么情况,您的应用程序都应该继续响应。
如果没有,使用“IIS Hang”DebugDiag 规则中的故障转储来监视输出文件夹,并在出现新文件时重新启动 IIS 肯定可以解决问题...
To create the memory dump of your web application, the Microsoft Debug Diagnostic Tools are your best option.
You can create an "IIS Hang" rule, monitoring a specific URL, and creating a memory dump whenever no response is received within a specified number of seconds.
The Debug Diagnostics Tools will not help you with regard to restarting IIS (or your app pool), but in general the built-in Application Pool restart options should be sufficient for that. If you make sure "Enable Pinging" is set for your AppPool (on its Health tab), and you also set the other Health/Recycling parameters appropriately, your app should continue responding no matter what happens.
If not, monitoring the output folder with crash dumps from your "IIS Hang" DebugDiag rule, and restarting IIS whenever new files appear should definitely do the trick...