Debugging SharePoint Projects (Event Receivers, Web Parts, etc.) in Visual Studio 2010 – IIS 7

This post is a tip on how to debug a SharePoint Project in Visual Studio on IIS 7 web server. Obviously, the easiest way is to hit F5 in Visual Studio and start debugging. But, that is not always possible, because using F5 builds your application and deploys is again. And you may not want to do that due to various reasons.

The other way is to use “Attach to Process” option in Debug menu. The problem here is when you open the “Attach to Process” window, you see lot of w3wp.exe processes and you really don’t know which process to attach the debugger to. So we end up attaching the debugger to all the processes. Here is how to get hold of the process that you want to debug.

  1. Open IIS (type inetmgr in the search box on the start menu). This opens the below window. 
  2. Click on the Worker Processes button shown in the red box in the above figure. This will list all the worker process running on the IIS Server.
  3. Look for the Application Pool name you want to debug. Remember the Process Id corresponding to it.
  4. In Visual Studio, in Debug menu, click on the “Attach to Process” option. This will open the Process window. Search for the Process Id of the Application Pool. Make sure you check the options below if you are running the application on different machine or as different user. Select the process and click on the Attach button. This will prompt a security warning. Select attach on the pop-up, and you are all set to debug.


About Rupesh

.NET and SharePoint 2010 developer
This entry was posted in Misc and tagged , , , , , . Bookmark the permalink.

One Response to Debugging SharePoint Projects (Event Receivers, Web Parts, etc.) in Visual Studio 2010 – IIS 7

  1. Anonymous says:

    Thank you very much… it resolved my issue. All the best to you.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s