In the recent update of Windows Azure Web Site, we added a new great feature – Web Jobs. This allows you to run custom jobs (executables or scripts) in one of three ways: on demand, continuously, or on a schedule.

Here are two great documents about awesome feature.

http://www.windowsazure.com/en-us/documentation/articles/web-sites-create-web-jobs/

https://github.com/projectkudu/kudu/wiki/Web-jobs

Months ago, I posted a blog about how to using Kudu Console to capture hang dumps to troubleshooting performance issues. The task is much easier using the Web Jobs. In this article, I will discuss about how to capture hang dumps using the Web Jobs.

1. Download and install Debugging Tools for Windows

The tool can be download here.

http://msdn.microsoft.com/en-us/library/windows/hardware/ff551063(v=vs.85).aspx

2. Create the Web Job Batch

Create a file named run.cmd with follow contents.

adplus.exe -quiet -HANG -o d:\home\site\wwwroot -pn w3wp.exe

3. Upload the tool

After installed Debugging Tools for Windows on your local machine, please go to the folder where the tool was installed. Zip follow files into a package like cdb.zip.

Run.cmd

Adplus.exe

Adplusext.dll

Cdb.exe

Dbgeng.dll

Dbghelp.dll

Note: By default, Windows Azure Web Sites runs a 32bit W3WP.EXE on 64bit system. Using a 32bit adplus.exe is recommended. If you are running site with 64bit process (Available for standard mode, can be enabled on the portal.), you must upload 64bit version of binaries listed above.

4. Create a “Run on demand” web job using the zip created in last step.

For details steps, please reference the document.

 

clip_image002

5. Capture dumps

Now, when you are experience any performance slowdown of your web site, you get the dump generated simply by just click “RUN ONCE”.

clip_image004

6. The dump is generated under the wwwroot folder, you can download using FTP.

clip_image006

See you next time,

Wei from GBSD DSI Team