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.


  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?

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.


IIS process w3wp.exe is not showing in Task manager processes?


I am having a very weird issue that I am unable to see w3wp.exe anywhere in my system. I am learning ASP.NET using tutorials. In my computer w3wp.exe process is not showing in the taskmanager. Please help, I got frustrated by searching it throughout the whole day. I have iis7.5installed!


Try refreshing or showing all processes – I believe it’s a checkbox option.

Then, refresh your browser and go for the attach to process option.


The w3wp.exe will not appear until the first request has entered the pipeline. So if you browse to your site and then open your task manager, you will see the w3wp.exe.


Visual Studio 2012 Remote Debugging – how to getting it working


The last couple of days I’ve been trying to figure out why a console application we use at work was throwing an error whilst trying to connect to oracle, we had some issues with Devart’s DotConnect for Oracle throwing the following error – ‘Error loading db connection’

Having tried a number of options it was suggested to me that I should try remote debugging, something that I had never actually done before, odd I know but I had never set this up so below are the steps I followed to get it working:-

  • Download and install Remote Tools for Visual Studio 2012 Update 2 here – (Make sure to install the correct version x86 or x64).
  • I then started the Remote Desktop Service making sure to ‘Run As Administrator’. An entry with the date and time and a description will be shown once we connect to the remote debugging service.
  • In my case I wanted to debug a console application – so I ran the console application (on the remote server)
  • Make sure to have your VS 2012 solution open, add some breakpoints to the code you’re looking to debug on the remote server – its important that the code on the remote server is exactly the same as the code which is open in VS 2012 – if not breakpoints wont be hit.
  • Now go back to Visual Studio and from the debug menu select Attach to Process, on this screen I change the Qualifier to the name of the remote server and select the console application process from the list of running processes on the remote server.
  • If you check back on the remote server it should say that you’ve connected to the remote debugger service.
  • If all is setup correctly then your breakpoints will be hit and hopefully you can figure out why your code wasn’t working
  • Turned out the licence file we had been using was empty and by debugging I was able to see a more detailed exception stack trace and information.

This is how I got it running fairly easily – if you run into any issues :- For more info on setting up remote debugging follow this link here.

Hope this helps someone out there.

How to Debug Multithreaded Programs in C#

[Originally posted by]:


This article is mainly focused on the process of multithread debugging. We have used thread in C# many times and we ususally ignore the thread debugging process, usually we only check the coding part and trace the error. As we know threading problems are difficult to handle. Like we have an immutable application that handles the many mutable objects (single thread). If we can see the problem of deadlocks, usually a deadlock is the easiest problem to debug. Let’s suppose we get a deadlock error in a stack trace. We can easily fix our code and prevent that error. With deadlocks, the problem is the same locks in different orders. Now let’s see some other aspects of threads.

Race conditions

A race condition is a difficult problem to debug and also a harder task to find from our code. Some other issues make our application cumbersome to handle.

Perhaps this article can help you if you are unfamiliar with the new thread window. In Visual Studio 2012 there is an improvised Thread window. In that Thread window we can debug our multithreaded applications easily. So before we start just try to work through the following topics that we will cover.

  • What threads are.
  • Working with multithreaded console applications.
  • Open the Thread Window
  • Working with the Thread Window

What a thread is

A thread is the smallest sequence of programmed instructions, or we can say that a thread is a small set of executable instructions that can be used to isolate a task from a process. And in some cases we can say that a thread is a component of a process.

We can use threads in C# using the System.Threading namespace.

Working with multiple threads in console applications

In this section we will see a simple console application, were I created 2 threads.

  1. namespace DebugThread
  2. {
  3.     class Program
  4.     {
  5.         static int i = 0;
  6.         static void Main(string[] args)
  7.         {
  8.             Thread T1 = new Thread(MyMethod);
  9.             Thread T2 = new Thread(MyMethod);
  10.             T1.Start();
  11.             T2.Start();
  12.             Console.Read();
  13.         }
  14.         static void MyMethod()
  15.         {
  16.             for (int i = 0; i < 10; i++)
  17.             {
  18.                 i++;
  19.                 Thread.Sleep(5000);
  20.             }
  21.         }
  22.     }
  23. }

Open the Thread Window

Step 1

Insert a Breakpoint in the code.


Step 2

Run our application (press F5).

Step 3

Click on the Debug menu and choose the windows option then select Threads as shown in the following image.


Working with Thread Window

Now let’s have a look at the Thread window.

As in the preceding image we can see the thread having no name. So, let’s assign the name of the thread.


Now we can see the thread name in Thread Window.


Flagging and Unflagging Thread

  • Go to the Debugging Location toolbar and click the Thread list and see how many threads appear in the list.
  • Go back to the source window and right-click the Thread marker again.
  • On the shortcut menu, point to Flag and then click the thread name and ID number.


To unflag threads

On the Threads window, right-click the line corresponding to the flagged thread. A shortcut menu is displayed. It has options to Unflag and Unflag All.

To unflag the thread, click Unflag. Or click the Red flag icon.


To freeze and Thaw threads

Freezing a thread will suspend its execution, in the debugging process. We can say Freeze has suspended the process and Thawing resumes the process. By Freezing and Thawing threads (suspending and resuming), we can have control of the threads running during the debugging process. It helps us when we are solving bugs related to concurrency.

In the Threads window, right-click any thread and then click Freeze.


Look at the active thread column. The pair of vertical bars now appear there.

Right-click the frozen thread and then click Thaw.


The active thread column and the Suspend column change.