public object AfterReceiveRequest(ref System.ServiceModel.Channels.Message request, IClientChannel channel, InstanceContext instanceContext) { // set the required state for logging, which is a shared IDictionary stored in OperationContext.Current (See WcfInteractionState.cs) _state.Set(Constants.ServiceRequestUriKey, request.Headers.To); _state.Set(Constants.InternalCorrelationIdentifierKey, Guid.NewGuid()); _state.Set(Constants.InteractionLogBufferKey, new List <string>()); request = CopyLogMessage(request.CreateBufferedCopy(int.MaxValue)); return(null); }
public void Flush() { var buf = _state.Get <List <string> >(Constants.InteractionLogBufferKey); File.AppendAllLines(Path.Combine(Path.GetTempPath(), "PerRequestlogging.csv"), buf); _state.Set(Constants.InteractionLogBufferKey, null); }