views:

975

answers:

3

I have webservices(that I myself created for database interaction) that are hosted in the same webproject that loads my silverlight project. Whenever I place a breakpoint to iterate through the code via the async methods, visual studio merely points me to the response event (completed event) skipping the code that is in the webservice therefore wouldn't know what is happening inside them. Is there an option to enable debugging in the webservices?

A: 

One way is to enable WebService trace option. By default, WCF services do not report detailed information as service errors are technology specific to that service and should not transcend the service boundary. You would need to write additional code to disclose detailed exception info. Enabling service tracing will allow you to log service calls and exceptions, and see the stack trace, without the additional coding, and polluting your client with service exception handlers.

The quickest way to do this is to use the WCF Service Configuration Editor (under Tools in VS2008). Once you run the editor, open config file that contains your service settings. In the editor go to Diagnostics menu "folder" and click 'Enable Tracing'. Clicking on the Trace Level options will bring up an dialog ... set the Trace Level drop-down to Error. Click on ServiceModelTraceListener and check the Callstack option ... maybe change the path of the log file for your convenience. Save.

When you double click the .svclog file that is generated, Microsoft Service Trace Viewer will fire up that will show you what the service is doing.

ib.

Ireney Berezniak
There isnt a way to debug via breakpoints and iterate through the code?
Drahcir
I never host my services in the same web project, so I am able to debug a WCF service without a problem. Try inserting "Debugger.Launch()" before the breakpoint. This should spawn the debugger which you can run in a new instance of Visual Studio.
Ireney Berezniak
A: 

Figured out why it was entering the webservices, I set the silverlight project instead of the web project as the start up project

Drahcir
+1  A: 

If Both of your services and web project in the same environment then ,

  1. Right click on wcfservice1 (service project folder) ---> debug ---> start new instance

  2. Similarly, Right click on web project folder ---> debug ---> start new instance

Make break point now in both the files and start debugging..simple...

SureshKumar.K