WCF service debugging hosted on local IIS does not work

I have one solution WCFSampleSolution, and I have all my projects - web service, client and website. The structure looks something like this:

  • WCFSampleSolution
    • C: \ WCFSample \ Site
    • WCFService
    • WCFWebClient

I created a WCFervice project for my services. It contains IService1.cs and Service1.cs. Then I hosted the service in IIS. I did this by creating a website and adding the .svc and web.config files to the website project. Then published it in IIS. When I run http: \ MyMachineName \ Website \ Service.svc, it shows a description of the service. Then I create a web client that calls the web service. I used the service link to add the service. It calls the Service1 method. It is working fine. But I can not debug this program / setup. I checked the configuration files in the WCFWebClient project and website, and they have the correct debugging settings.

<compilation debug="true"> 

I set breakpoints, but control never comes to my seb service. I also tried to attach the process, but it also does not work. But I was able to debug one of my other WCF projects. The setting was a bit different. In this project, I copied the .svc file and configuration in my web client, and debugging works fine.

Please, help!

+7
debugging web-services wcf
source share
3 answers

You host your service in IIS, so I'm sure you should connect to the w3wp.exe process. When trying to connect, if VS, built into the web server, starts up, then joins this process.

+9
source share

What I find particularly easy is to open two instances of the visual studio (especially if you use NUnit or do something to check the code). One will attach NUnit or whatever, and the other will attach the w3wp.exe process. The easiest way:

1) Place a breakpoint in the 1st instance of the visual code studio right before it enters the WCF service hosted on your computer.

2) As soon as the code stops at a breakpoint, set breakpoints in the second instance of the visual studio where you want to break, then attach the w3wp.exe process.

3) As soon as you continue, the breakpoint on the service code should be removed.

Sometimes it is easier to find the process ID when connecting w3wp.exe. Using IIS, you can go to the "Workflow" and find the process identifier to join the application pool name.

+4
source share

@ user465876 - here you can find another approach that poses a less complex problem: WCF can no longer go into the local local service - why not?

+1
source share

All Articles