RKh
RKh

Reputation: 14159

Debug WCF service locally from another application

I have already checked a couple of posts on SO. I have a slight confusion on debugging the WCF on local system.

I have two solutions:

  1. WCF service itself
  2. Windows Console Application which consumes this service.

In local system IIS is installed. I ran the WCF application and message shown "Service hosted on IIS".

Now I want to debug the other application. I ran that application as well from VS. I want to debug methods in both, WCF and application.

I want to know whether this way, I can debug WCF application or there is any other better way to debug. Can it be installed as a Windows Service or only IIS is required?

Upvotes: 1

Views: 2226

Answers (2)

mahlatse
mahlatse

Reputation: 1307

The fastest way( and easiest that I can think of Debugging the WCF service if you have both project for them is this

  1. Create a new Solution(or just use an existing VS solution)
  2. Add both the WCF service Project and Console Project to the service(Can be run on different instances though)
  3. Set the Console App to be the main startup application
  4. Add a Service Reference to the Console App(and click the discover locally button)
  5. This will create a Service Reference with the Service Library created
  6. Then just run the methods from the console APP and it will hit your Service BreakPoints

Upvotes: 1

Marc
Marc

Reputation: 3959

You can host WCF services on IIS, within a Windows Service or even in your applications (WinForms, WPF, Console). But this has nothing to do with your requirement about debugging.

If you want to debug a running process on your local machine, you can attach the debugger to another process or you have to look for remote debugging if that process runs on another machine.

But since you have the client and server code in your Visual Studio, why not start both applications together?

  • If you have two solutions, you can launch one Visual Studio instance for the client solution and another Visual Studio for the server solution. Then press F5 in both of them.

  • It is even easier if you have both projects in one solution: Simply change your solution settings to have multiple startup projects and hit F5.

Either way, you can debug your client and server code locally.

Upvotes: 3

Related Questions