Troubleshooting Specific ASP.net 1.1 Exceptions with ADPlus.vbs

 

 

 

The following troubleshooting steps are recommended asp.net web apps running under the 1.1 framework.  For similar instructions to use for use with other framework versions, or if you’re unsure which version of the .net framework your web application is using, please click here.

 

 

 

SYMPTOM:

 

When browser to a an asp.net web application the browser relays a complaint from .net about System.<SomeSpecificException>.   Some examples include:

·         System.InvalidCastException

·         System.CannotUnloadAppDomain

·         System.Threading.SynchronizationLock

·         System.InvalidOperationException

 

 

 

 

TROUBLESHOOTING:

 

 

 

1. Install Debug Tools

 

Please install the Debugging tools for Windows onto the server that you’re seeing the exception on.  

 

 

Install Debugging Tools for Windows 32-bit Version
Download page for the latest 32-bit packages.

 

 

By default the tools are installed to one of two places:

 

C:\Program Files\Debugging Tools for Windows       (for a 32-bit OS running IIS and ASP.net in 32-bit mode)

 or

C:\Program Files (x86)\Debugging Tools for Windows     (for a 64 bit OS running IIS and ASP.net in 32-bit mode)

 

This page assumes the default location of C:\Program Files\Debugging Tools for Windows.  However, you can install the tools to the directory of your choice—it doesn’t have to be the system partition.  If for instance you have limited freespace (less than 2 gigs) on the C:\ drive or if you’re just not comfortable installing anything to the system partition, you can choose an advanced install and have them installed, for example, to the D:\ drive.   In fact, if you’re uncomfortable with or restricted from installing tools onto the server at all, you can install the tools onto a workstation and then copy the “Debugging tools for Windows” folder to the server.

 

If you happen to be running another dump tool, you may want to uninstall or disable it.   For instance, if you are running DebugDiag, please deactivate or delete any crash rules that might be active. 

 

 

 

 

2. Create and Modify a Config File

 

Copy the following text into notepad and save it as “Exception.cfg.”  You will need to make one change.  You’ll need to replace the “System.YourExceptionGoesHere” with whichever exception you’re troubleshooting.  So if, for instance, you’re server is suffering from the System.InvalidOperationException, for instance, you’ll want to change System.YourExceptionGoesHere in the config file to System.InvalidOperationException.   You also might want to consider changing the d:\dumps output location to another folder on another volume if you’d prefer the dmp files to not be written to d:\dumps. 

 

<ADPlus>

 

    <!-- Configuring ADPlus to log all first chance exceptions -->

    <!-- Will still create full dump for any type of second chance exceptions -->

 

 

  <Exceptions>

     <Config>

        <!-- This is for the CLR exception -->

       <Code> clr </Code>

       <Actions1> Log </Actions1>

       <CustomActions1> !cce System.YourExceptionGoesHere 1; j ($t1 = 1) '.dump /ma /u d:\dumps\HttpException.dmp' ; ''  </CustomActions1>

       <ReturnAction1> gn  </ReturnAction1>

       <Actions2> Log;FullDump </Actions2>

     </Config>

  </Exceptions>

 

</ADPlus

 

 

 

3. Move the Config File

 

Copy the Exception.cfg file to the “C:\Program Files\Debugging Tools for Windows” folder of the server suffering from the exceptions.  

 

 

4. Attach Debuggers to W3WP.exe’s

 

The idea here is we want to use the adplus.vbs script to attach cdb.exe debuggers to the w3wp.exe’s which are seeing exceptions.  To do so, open a command prompt and cd to C:\Program Files\Debugging Tools for Windows.   Enter the following command:

 

cscript.exe adplus.vbs –c exception.cfg

 

You should see one or more minimized adplus process windows appear in the task bar—you’ll get one for each w3wp.exe.  You also might see in Task Manager (show all processes) that you have one new cdb.exe for each w3wp.exe. This is your sign that debuggers have been attached to all the w3wp.exe processes and they’re waiting for your specific managed exception to occur.  When that exception is encountered, all that is in the memory spaces of those w3wp.exe processes will be written into .dmp files. 

 

5. Wait for the Exception, Wait for Dumps

 

The writing may require anywhere from 20 seconds to 200 seconds depending on the size of the w3wp.exe’s.  Be sure to not run IISRESET until all the dmp files have finished being written to or else the dmp files become worthless.

 

Do NOT log off of the server.  You may CTRL+ALT+ DELETE > Lock Computer, but don’t log off.  If the server is rebooted, iis is restarted, or you are logged off the server, you’ll need to re-run the command above to re-attach the debuggers to the IIS processes.

 

When the exception is seen again in the browser or the event logs, check to see if the minimized adplus windows have vanished.  And see if new dumps were written to the output directory specified in the configuration file.

 

 

6.  Zip and Upload Dumps

 

Please zip these files and upload them to your ASP.net support engineer for analysis.  He or she should create a secure https workspace to upload to.  If you need an asp.net support engineer, visit http://support.microsoft.com/ to begin the process.

 

 

 

If dumps were not triggered, examine the txt files found in the “C:\Program Files\Debugging Tools for Windows\logs” folder to try to get an idea of what went wrong.   Also provide them to your asp.net support engineer.  Examine the config file to make sure the exception was not misspelled.  Make sure the output directory had at least 1-2 gigs of freespace.