Debugging ASP.NET WebDAV Server Web Application

Because WebDAV server running as ASP.NET web application in IIS cannot be run directly from Visual Studio with Run (F5) command, to debug the code you will have to attach the debugger to the running process of your WebDAV server. Follow the steps below to attach the debugger:

  1. Make sure you build the application in the debug mode and set the breakpoint.
  2. Access you WebDAV server with any client application (Microsoft Web Folders, Mac OS X WebDAV Client, etc). This will load the server code into memory. See Accessing WebDAV Server.
  3. In Visual Studio go to Debug->Attach to Process menu. Check both Show processes from all users and Show processes in all sessions checkboxes. Select Attach to: Managed code.
  4. Find w3wp.exe (for Windows Server 2008, Windows 7, Windows Vista and Windows Server 2003) or aspnet_wp.exe (for Windows XP) and click Attach button. If you do not see w3wp.exe (aspnet_wp.exe) in the list of running processes usually this means that your server is not loaded into memory.

How to attache w3wp.exe or aspnet_wp.exe process

To debug applications on Windows 7 and Vista make sure Visual Studio have enough permissions for debugging applications. The simplest way is to run Visual Studio with administrative privileges:

How to run Visual Studio with administrative privileges

A significant help in debugging could be provided by WebDAV Server logging features. All requests/responses and, what is more, important all exceptions are logged to the log file created by the engine. By default, the log file is created in the folder where your .exe or .dll file resides. If you do not see the log file usually this means that there are not enough permissions for creating a file or requests does not reach the web server. See WebDAV Server Logging.