Breakpoint not hit when remote debugging on Internet for ASP.NET

[Origin]: http://stackoverflow.com/questions/385826/breakpoint-not-hit-when-remote-debugging-on-internet-for-asp-net

I have sit up remote debugging on a Window 2003 server accessed through the Internet. I have VS 2008 SP1 installed on my XP dev box.

I launched the site on the remote server and attached to all the w3wp.exe processes on the remote server. I noticed that the .dll did not load the symbols file. When I try to load the corresponding .pdb file from my local machine, it says file does not match. I have “Require source files to exactly match the original version” unchecked. The assembly on the remote server is the same as the one on my dev box. The site and .dll was copied from dev boc to remote server and code hasn’t changed since. So I know .dll and .pdb files should match or at least I need to force the matching.

Questions:

  1. How do I get the .pdb file to load? I know breakpoints won’t trigger unless symbols file is loaded. I noticed that the .pdb file does not exist in the “Temporary ASP.NET Files” folder on the remote server. The .dll does.
  2. What’s the proper sequence to start debugging remotely inside VS? (Remote set up is done and I can see remote processes). In VS, I have start page as the url of the remote site. I start without debugging and then attach to w3wp.exe(s) on the remote. Is this all?
shareedit

Are you running a Web Site or a Web Application (is it a compiled project, that you deploy the DLL for, or a collection of aspx and aspx.cs files that you deploy)?

If it’s a Web Application, did you deploy a release build, or a debug build? You won’t be able to hit breakpoints when “debugging” a release build, as the code is fairly heavily optimised.

Have you got “debug=true” set in the web.config compilation section? If not, again, debugging is going to be difficult.

Finally, the steps I use when remote debugging are:

  1. Deploy latest debug build of files
  2. Request page on remote server to start/restart application
  3. Ensure that the VS Remote Debugging Monitor is up and running on the remote server
  4. In VS, go to Tools (or Debug) | Attach to Process…, ensure that the remote server is selected in the Qualifier, and select w3wp.exe for the correct app-pool, etc.
  5. Request page that will fire break point.
  6. Debug!

If the breakpoints are hollow (thin red circles rather than filled disks), I’ll often check the Stack window in VS to see what has and hasn’t been loaded.

shareedit
Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s