Debugging Services Consumed from Silverlight

If you're used to debugging ASP.NET web applications together with WCF services, you will know that Visual Studio automatically attaches the debugger to the service process in addition to the website. When you It doesn't do this for services being called from Silverlight. Instead, Visual Studio will probably warn you that the service call will fail, but we've taken care of that problem with the behavior extension from the previous post.

The solution is fairly obvious: you will have to make sure that the debugger is attached to both your web application and your service.

You can manually attach the debugger to an extra process, or use the Multiple startup projects feature. Right-click the top line in the Solution Explorer and select Set StartUp Projects. In the following dialog, make sure that both projects are set to Start and that Multiple startup projects is selected: Multiple startup projects dialog

Once you've done this, both projects will be started when you press F5. Visual Studio will launch the WCF Test Client for your service, which you might not need. You can disable this behavior in the project options, under the Debug tab: WCF Library project debug tab Remove the text /client:"wcftestclient.exe" from the command line arguments (highlighted in the screenshot) if you want to stop the test client from being run. If you want to disable it temporarily, a nice trick is to change it to /clientArgs:"wcftestclient.exe" and remove the Args bit when you need the test client again.

Comments (1) -

  • This is what I was looking, it's good!

    In WCF project properties, below Web, I prefered to check: "Don't open a page. Wait for a request...".


Add comment