Click here to Skip to main content
13,863,479 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


12 bookmarked
Posted 7 Apr 2009
Licenced CPOL

Debugging a Deployed Site

, 7 Apr 2009
Rate this:
Please Sign up or sign in to vote.
"It works on my machine." How many times have we heard that?  Getting something to work on other machines, after deployment, can be the final challenge in a successful project.

"It works on my machine."

How many times have we heard that?  Getting something to work on other machines, after deployment, can be the final challenge in a successful project.  The worst case scenario is having to go to the problem machine (hopefully it isn't in the remote reaches of Siberia) installing the IDE, patches, source code, third party libraries, compiling and then debugging.  It's not a pleasant task.

An often overlooked but useful tool is:  System.Diagnostics.Debug.WriteLine(...)

Here are some sample lines in global.asax:

<%@ Application Language="C#" %>
<script RunAt="server">
    void Application_Start(object sender, EventArgs e)
    void Application_BeginRequest(object sender, EventArgs e) 
    void Application_EndRequest(object sender, EventArgs e)
    void Session_Start(object sender, EventArgs e)

Here is what the outputs look like in Visual Studio: Debug->Windows->Output. I turned off the Module Load messages to keep the output cleaner. An interesting thing to note is that the first Application_BeginRequest triggers the Session_Start event. Clicking a button a few times generates the other Application_BeginRequest events.


So far so good, but how does this help debugging on a deployed machine? The answer is by using a free tool called DebugView from Sysinternals.  Microsoft has acquired Sysinternals so you can search Microsoft's web site to download it.

Here is the same output captured by DebugView. The extra lines are caused by a Sound Card device driver on the host machine (the developers may have made a mistake).



  1. Depending on the operating system, you may need to turn on global capturing of events in DebugView:

    Capture->Capture Global Win32

  2. Debugging strings are turned off when compilation debug is false in web.config. To get the debug strings to work, debug must be "true"
    <compilation debug="true" strict="false" explicit="true"> 
  3. If you run the site in Visual Studio, you will not see the strings in DebugView.

I hope you find this information useful.

Steve Wellens


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Steve Wellens
EndWell Software, Inc.
United States United States
I am an independent contractor/consultant working in the Twin Cities area in Minnesota. I work in .Net, Asp.Net, C#, C++, XML, SQL, Windows Forms, HTML, CSS, etc., etc., etc.

You may also be interested in...


Comments and Discussions

Generallog4net is a better solution to this problem Pin
HightechRider7-Apr-09 13:46
memberHightechRider7-Apr-09 13:46 
GeneralRe: log4net is a better solution to this problem [modified] Pin
Steve Wellens7-Apr-09 14:13
memberSteve Wellens7-Apr-09 14:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190214.1 | Last Updated 7 Apr 2009
Article Copyright 2009 by Steve Wellens
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid