You are implementing a Windows Communication Foundation (WCF) service contract named lContosoService in a class named ContosoService.
The service occasionally fails due to an exception being thrown at the service.
You need to send the stack trace of any unhandled exceptions to clients as a fault message. What should you do?
A.
In the application configuration file on the client, add the following XML segment to the system.serviceModel/behaviors configuration section group.
<endpointBehaviors>
<behavior name=”debug”>
<callbackDebug includeExceptionDetaillnFaults=”true” />
</behavior>
</endpointBehaviors>
Associate the debug behavior with any endpoints that need to return exception details.
B.
In the application configuration file on the service and all the clients, add the following XML segment to the system.diagnostics/sources configuration section group.
<source name=”System.ServiceModel” switchValue=”Error” propagateActivty=”true”>
<listeners>
<add name=”ServiceModelTraceListener” initializeData=”appntracelog.svclog” type=”System.Diagnostics.XmlWriterTraceListener” />
</listeners>
</source>
C.
Apply the following attribute to the ContosoService class.
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
D.
For each OperationContract exposed by lContosoService, apply the following attribute.
[FaultContract(typeof(Exception))]
Explanation:
ServiceBehaviorAttribute.IncludeExceptionDetailInFaults PropertyGets or sets a value that specifies that general unhandled execution exceptions are to be converted into
a System.ServiceModel.FaultException<TDetail> of type System.ServiceModel.ExceptionDetail and sent as a fault message.
Set this to true only during development to troubleshoot a service.
I thing answer# A is correct too
can anyone help
Correct ans is C.Refer http://msdn.microsoft.com/en-us/library/ms788985(v=vs.110).aspx
The correct answer is C. It’s not A, because that enables exceptions in details in CALLBACKs not in service calls.
C