views:

524

answers:

3

Hello there,

I have my WCF Service hosted in Windows Service. The client application is a website project to which I added the Service reference.

I was not using any error logging/tracing... but now I feel I should implement as it will help me not to make void guesses.

Please guide me for the best practice so that I can quickly handle errors and pin point the exact issue.

Thank you!

+2  A: 

If you just need to see the error message for troubleshooting purposes, you can set IncludeExceptionDetailInFaults attribute in your app.config. This will give you the full exception details, including a stack trace on your client. However, be aware that exception details may include sensitive information, so don't leave it on in a production system without understanding the risk.

If you want to take it a step further, you can implement the IErrorHandler interface. You can use this as a single point of logging exceptions or translating them into published Fault Contracts.

Mark Seemann
+1  A: 

The first step to maintaining a more robust WCF Service is logging all operations made.

The Logging Application Block works for me. you might also want to check log4net.

Gilad
A: 

If you're looking for general information on debugging WCF services, I recommend reading the following articles:

Debugging WCF Services

Configuring Message Logging

Configuring Tracing

Debugging WCF Services in Visual Studio 2008

Justin R.