WCF Beginner Tutorial - Unable to debug (step into)

12,164

Solution 1

There are several possible options for what you're trying to achieve:

  1. As error specifies, client debugger can't attach to the server process because it's already got a debugger. Try starting server process without debugger.
  2. Putting client and server code into the same solution and then using RMC -> Debug -> Start new instance on your server and client projects
  3. Running server process with debugger and then using "Debug -> Attach to proces.." to attach to client code (it shouldn't be run with debugger)

I'd recommend (at least for the time being) putting those two into the same solution for debugging purposes. It's easier to work with in the single workspace.

Solution 2

You should attach the Service to the client. In the VS instance where the service is running, go to debug->Attach->(devenv.exe of the VS instance where the Client is running) and then start the client.

Share:
12,164
Varun Sharma
Author by

Varun Sharma

Updated on June 12, 2022

Comments

  • Varun Sharma
    Varun Sharma almost 2 years

    I am doing the following tutorial http://msdn.microsoft.com/en-us/library/ms731835%28v=vs.100%29.aspx and the program is working perfectly fine. Both Service and Client are in different solutions. I can start the service from one visual studio and then run the client program successfully. However I want to do debugging. I want to step into Service code from Client code. When I try doing that, I get the following error.

    "Unable to automatically step into the server. Attaching to the server process failed. A debugger is already attached."

    Both client and server are console applications and service is slef hosted. I also tried enabling debug = true in the app.config file of client.

  • Varun Sharma
    Varun Sharma about 12 years
    The second approach works but my goal is not to achieve that. I want them client and server in two different visual studios. When I use the first approach I get the following new error - "Unable to automatically step into the server. The remote procedure could not be debugged. This usually indicates that debugging has not been enabled on the server." I am not sure how to achieve the third goal.
  • Dmitry Reznik
    Dmitry Reznik about 12 years
    Are you running server process built in Debug mode ? Regarding the third one, you start server process from visual studio like usual (F5), then start client process from exe file and then in server visual studio click on menu Debug -> Attach to process.. and select your client exe process.
  • Varun Sharma
    Varun Sharma about 12 years
    Sorry I did what you said. Started the service by pressing F5. Than ran the client program (Ctrl + F5). But then when I tried attaching the client process from server visual studio, it is disabled. I cannot attach it. Also no point in running client program from command line because it will finish in less than 1 second. Just one function call to the service is there. I need to put a breakpoint in the client program.