public void ProvideFault(Exception error, MessageVersion version, ref Message fault)
 {
     if (!(error is FaultException))
     {
         LoggingExceptionDetails guidException = new LoggingExceptionDetails();
         FaultException<LoggingExceptionDetails> faultException = new FaultException<LoggingExceptionDetails>(guidException, new FaultReason(guidException.Message));
         fault = Message.CreateMessage(version, faultException.CreateMessageFault(), faultException.Action);
         this.LogMessage(error, guidException);
     }
 }
 private void LogMessage(Exception error, LoggingExceptionDetails wrapperException)
 {
     try
     {
         Dictionary<string, object> extendedProperties = new Dictionary<string, object>();
         extendedProperties.Add("Guid", wrapperException.ExceptionId.ToString());
         if (BindingType == typeof(NetTcpBinding))
         {
             extendedProperties.Add("RequestMessage", OperationContext.Current.RequestContext.RequestMessage);
         }
         if (BindingType == typeof(BasicHttpBinding) || BindingType == typeof(WSHttpBinding))
         {
             extendedProperties.Add("RequestMessage", OperationContext.Current.RequestContext.RequestMessage);
         }
         LoggingHelper.Write(new LogEntry(error, LoggerCategories.WCFGeneral, 1, 1, TraceEventType.Error,string.Format("{0} (DetailException): {1}", Assembly.GetExecutingAssembly().GetName().Name, wrapperException.ExceptionId), extendedProperties));
         // LoggingHelper.Write(new LogEntry(error.GetBaseException(), LoggerCategories.General, 1, 1, TraceEventType.Error, string.Format("{0} (BaseException) : {1}", Assembly.GetExecutingAssembly().GetName().Name, wrapperException.ExceptionId), extendedProperties));
     }
     catch (Exception exII)
     {
         //TODO: si runtime llega aqui significa que el databasetracelistener no funciona. Grabar en fichero texto utilizando otro tracelistener
         System.Diagnostics.Debug.Write(exII.Message);
     }
 }