Debug .NET Portlets in Real Time

Development by matt on June 12th, 2007 No Comments

We talked about trace.axd as a debugging solution, but often it’s even easier to step through your code as it runs. When doing regular .NET application development, the browser connects directly to the .NET application and allows you to step through the code in real time, watching variables, etc. The problem is, when you’re doing portlet development, the browser connects to the portal, and the portal connects to your application. You can’t avoid this in most cases because the portal is sending context information to the portlet running your code via HTTP headers. When your code is running this way, Visual Studio won’t stop at the breakpoints specified unless you attach the debugger to the .NET process by selecting "Debug: Processes", then choosing the .NET worker process:

IIS Attach to process

Click through for some more tips…

A couple of things to note:

  • In Windows XP and 2000, the .NET worker process is called aspnet_wp.exe.
  • In Windows Server 2003, the process is called w3wp.exe.
  • When you’re debugging, it’s a good idea to turn the Web Service timeout way up (like a minute or more) so that the portal waits for you to finish stepping through your code before timing out.
  • If you do turn up the Web Service timeout, remember to turn it back down to avoid the perception of a slow portal once you’re done developing.
  • In IIS 6, you can create a separate Web Application for your portlet, which uses a separate worker process (notice the "Debugged Process" section in the screen shot above). This is especially useful if you’re running the .NET portal in the same IIS instance in your dev environment; occasionally this method of debugging will cause the worker process to reset, and it’s not very convenient waiting for the portal to restart all the time if it’s in the same Web Application. By deploying the code to a different Web Application, you won’t have to wait for the portal when it recycles.
  • No Responses to “Debug .NET Portlets in Real Time”

    Leave a Reply

    You must be logged in to post a comment.