Tuesday, July 21, 2009

Remote IIS Debugging : Debug your ASP.NET Application which is hosted on "Remote IIS Server"

Background :

In the last month I have published an article on Debugging of ASP.NET Application that hosted on IIS server using process attaché. And I have got a very good response from all the readers, specially Yankee Imperialist Dog! , Pete O'Hanlon, Dr.Luiji , Manas Bhardwaj and many others . And they have suggested me for a follow up article on IIS Remote debugging. Thanks to all of them for their feedback and giving me another opportunity to write an article. I think this will help you all. Please give your valuable suggestions and feedback to improve on my article.

Introduction :

Before starting with this article, I will request you to read my previous article Debug Your ASP.NET Application that Hosted on IIS : Process Attach and Identify which process to attach . This article will give you the basic understanding of Debugging ASP.NET Application that is hosted on Local Server, along with Process selection among multiple processes. And article was all about if you have IIS installed in local server, that means you have hosted your site on your local development environment or your Web server/ production server having visual studio installed. But this is not the real scenario.

Now coming back to this article, this article is all about the IIS remote debugging. You are developing your application in you local system which is hosted on remote web server and now you need to debug it. How will you do that ? This article will describe all the necessary steps like how to configure remote debugging, attaching process from remote server, start debugging etc. This is one of the most challenging task in ASP.NET. Hope I have explained it clearly.

Visual Studio Debugging Features for ASP.NET

We can have three different way to debug our application from Visual Studio. They are:

  • Visual Studio Internal Debugger
  • Local IIS Debugging
  • Remote IIS Debugging

Visual Studio Internal Debugger :

We are all aware of that visual studio is having its own internal ASP.NET debug engine which is used to debug our ASP.NET web application while we are developing it. The process which is used to debug the application within visual studio is WebDev.WebServer.Exe . ASP.NET Engine uses WebDev.WebServer.exe to debug the application. Now if you want to know more details about it please read this .

remote4.jpg

Fig: Block Diagram for Visual Studio Internal Debugger

Local IIS Debugging :

This is all about my last article . Just brush up the things, I am explaining the whole scenario using following diagram. [ Though it was not necessary, because I have already explained it in my last article, still I have used only for the co-relation with the remote debugging. ]

remote5.jpg

Fig: Block Diagram for Debugging ASP.NET site from Local IIS Server

In local IIS debugging, IIS should be installed in the local system where we have visual studio installed. For debugging the application hosted on IIS from visual studio, we need to attach the worker process (w3wp.exe) with in visual studio. After that we will able to start the debugging of the web application.

Remote IIS Debugging :

This is the main topic which we should cover in this article. It is one of the best features and it is very much helpful when we do not have a IIS Server installed in local system or when we have to store the applications at a centralized location. The scenario comes when you are having with your application code in your system and the build which was deployed on different IIS server. Below diagrams shows the overall diagram for remote debugging.

remote6.jpg

Fig: Block Diagram for Remote debugging of ASP.NET Application

Remote debugging with Visual studio and Remote IIS is very easy to setup. The tool which is used to setup and configure the process is know as "msvsmon.exe". I have describe each and every steps to start, configure the msvsmon tool and debug the application. But before that just have a look on why should we need remote debugging.

Why Remote Debugging :

Before going into details, we need to know when we have to use remote debugging,

  • Local development server does not have IIS installed.

  • Development server and Build/Released/Hosting Server is different

  • Application located in centralized location.

Remote Debugging Tool

The tool which is used to remote debugging of the ASP.Net application know as "Msvsmon.exe" . The Remote Debugging tool (Msvsmon.exe) is a small windows based application that Visual Studio 2005 uses for remote debugging. It has very simple UI which makes it very simple to setup and configure During remote debugging, Visual Studio 2005 runs on one computer and the Remote Debugging Tool runs on the remote computer along with the application you are debugging.

remote7.jpg

Fig: Block Diagram for Remote debugging of ASP.NET Application with msvsmon

If we want to debug the application which is hosted on remote IIS, we have to start the msvsmon.exe to the remote server, and our development system is the debugger host where we will debug our code.

Start msvsmon.exe

Msvsmon.exe is installed to the following paths:
  • Install path\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x86

First of all we need to Run the Application from the location and we will get following screen,


See full detail: http://www.codeproject.com/KB/aspnet/IISRemoteDebugging.aspx

No comments: