Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Beginner Tutorial - Unable to debug (step into)

Tags:

debugging

wcf

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.

like image 221
Varun Sharma Avatar asked Apr 03 '12 03:04

Varun Sharma


People also ask

How do I debug a WCF application?

In Solution Explorer, right-click the WCF Client project and then click Set as Startup Project. Enable debugging in the app. config or web. config file.

How do I debug SVC service?

Visual Studio provides you a test client to run and debug the service. To use this test client, select your service in Solution Explorer ( CustomerProfile. svc ) and, from the Debug menu, select Start Debugging (or just press F5). Visual Studio will run the code in debug mode using the WCF Test Client, as shown in ...


2 Answers

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.

like image 142
Dmitry Reznik Avatar answered Oct 23 '22 03:10

Dmitry Reznik


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.

like image 26
Harsha Avatar answered Oct 23 '22 05:10

Harsha