Debug wcf Web Service at localhost

We all know web service play a vital role in the web application, windows application or even in mobile applications. Most of the time we need to debug the web service to know what data passing to wcf web service or even in some exception case.

So today I will let you know how to debug WCF Web Service.

Open your visual studio and Right Click on the Solution Name and select the Set StartUp Projects..

It will open a dialog like below image.

debug wcf web service

Select the Multiple startup projects:, then set your application and wcf web service action as Start. After set both action start go to wcf web service method which you want to make debug and add the library namespace using System.Diagnostic;.

After that add the Debugger.Break(); line code inside the function which you want to debug like below image.

debug wcf web service1

Now start run you project and it will automatically stop at the Debugger.Break(); point. You can debug you wcf web service function by press F10 key.

One thing please note before you debug the wcf web service, its not already running. You can check it from the right bottom tray icons, If there web service icon present it means your web service is already running. Please stop it and try again by follow all the steps again.

If you face any problem while debug please feel free to comment, I will help you guys.

Happy Coding….

Posted by | View Post | View Group