You are implementing a Windows Communication Foundation (WCF) service contract
named IContosoService 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.
Apply the following attribute to the ContosoService class.
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
B.
For each OperationContract exposed by IContosoService, apply the following attribute.
[FaultContract(typeof(Exception))]
C.
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 “> < callback Debug includeExceptionDetailInFaults=”true” />
</behavior> </endpointBehaviors> Associate the debug behavior with any endpoints that
need to return exception details.
D.
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” propagateActivity=”true”> <listeners>
<add name=”ServiceModelTraceListener” initializeData=”app_tracelog.svclog”
type=”System.Diagnostics.XmlWriterTraceListener” /> </listeners> </source>
Explanation: