I have the following decorated on my service
<ExceptionShielding("MyExceptionPolicyName")>
when a fault exception is thrown, my policy picks up the error and logs in just fine. It takes the handlingInstance Id and logs it along with the error for reference. What I'm noticing, is the Guid returned in the Fault "Error ID:" is different than that one passed into the handling instanceId.
I've also tried to decorate the operation like so
<FaultContract(GetType(ValidationFault))>
but this produces the same results.
What I would like to do is some how capture that "Error ID:" passed back to the consumer so I can log it along with the exception. *addition info: the exception policy handler is a custom one that takes an exception, and logs it's various properties and data into a specific exception log db schema.
Anyone know how to accomplish this?
UPDATE: per @Jay Patel 's comment, I added this to my config to enable tracing
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\Temp\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
I then executed a request to get a fault response shielded by exception shielding. The fault response string is formatted like so: "An error has occurred while consuming this service. Please contact your administrator for more information. Error ID: {GUID}"
I then viewed the trace log, and found no evidence of the GUID or this string.
Here is the .net wcf exception enterprise-library fault