Category Archives: debugging

My favorite FREE debugging tools

1. Fiddler
My favoritue tool for debugging web communication must be Fiddler. Fiddler enables you to view all requests from your client to a server, you can see the raw http requests – which is very useful for deubgging SOAP requests or similar web service communication – and it allows you to display all request/responses in a timeline which is quite useful for performance debugging. And much other – fiddler is one of my must have debugging tools.

2. Process monitor
The precedors of this tool are FileMon and RegMon – now you have both of them in one tool + some additions. Process Mintor can be downloaded from here. It monitors all IO activity to disk and registry, you can apply filters – for example by filtering out specific processes or specific file paths – and you can highlight rows by searching for key words. When your application hang’s who wouldn’t like to know what was the last dll it was accessing?

3. WinDbg
The WinDbg tool requires some hours for one to get acquainted, but even if you just allow youself to spend just a few hours with this tool it will help you determining why your application crashed, where that memory leak actually originates and so on. Don’t forget to acquite the symbols for your server etc. – please check out If you are a developer and used to working with Visual Studio, you could probably get much help from just attaching Visual Studio to the process you’d like to debug instead of learning WinDbg.

4. PerfMon (Performance Monitor)
The built in Performance Monitor (hit start -> run and type perfmon) is also one of my favorites. I can hardly count the times the perfmon has helped by either verifying where I have a problem or that I actually didn’t have the kind of problem which I expected. I use it both on all sorts of servers and on clients.

5. SQL Profiler
The profiling tool for SQL Server is installed with the SQL Server Management Studio. As with the others this is one of my heavily used tools. I use it for understanding which queries execute slowly, how the queries are distributed – and also, together with the PerfMon tool it has helped me understand which queries result in e.g. disk queues etc.

Other tools would deserve to be mentioned – sucn as LogParser, and some tools I am just about to install, and hopefully they will provide me with even better debugging options – such as baretail.

How to debug HTTP Error 401 UnAuthorized in ASP.NET via IIS

A frequent question in debate forums is how to debug 401 errors. Here I try to shortly provide some guidance – hoping that it will help you. Please note that this guide assumes you are not using forms authentication – ‘cause that’s a whole other ball game:-)


Step 1: Find out which user the actual windows process is running under

Like any other app, your website will be ran by a normal Windows process, and like all other process some user is running it. The first step therefore is to locate the actual user who’s running your app since there’s good chance that this user does not have the necessary authorizations.

The flow chart to the left describes how to find out schematically.

Step 2: Determine which user rights applies to your website folders and files

Open your physical website folder. In IIS this path can be found on the “Virtual Directory” tab in the “Local path” text box.

If your path is in a sub directory to e.g. a Visual Studio folder such as C:\Documents and Settings\mhm\My Documents\Visual Studio 2005\WebSites\WebSite1 the default security permissions would be:

  • Administrators have full access
  • You (or the currently loged in user) have full access
  • SYSTEM user has full access

Other users have no rights. You can check this by right clicking your folder, select properties, and select “Security” tab. To add a user click “Add…”. Type in the name of the user you wish to add and click “Check names” – if the user you typed in exists, it will be underlined. Now you can click OK button, and the user will be added to the list. To ensure that the files in your folder have inherited the new right, please check a couple of files in the folder.

The authorized user must have sufficient rights in your website folder! This is why it is so important that you know which user is running your process.

Now, what are sufficient rights then? At least it is reading rights. If you perform other I/O operations, additional rights will be necessary. If you perform serialization, writing rights would be needed to c:\windows\temp folder as well. DB access rights could be necessary etc. In general, aim for the lowest level of rights.

Tip! Instead of executing your website from some “Program Files” folder or Visual Studio projects folder, you can copy your website folder to the c:\inetpub\wwwroot directory. It should then inherit the parent folder’s (wwwroot) security setup which is targeted directly at iis websites and will therefore often be sufficient.

Please check-out this as well.