public override void ProcessMessage(SoapMessage message) { if (GlimpseManager.IsGlimpseActive() == false) { return; } switch (message.Stage) { case SoapMessageStage.BeforeSerialize: _result.RequestArgs = GetRequestArgs(message); break; case SoapMessageStage.AfterSerialize: _result.RequestXml = GetXml(_newStream); CopyStream(_newStream, _oldStream); break; case SoapMessageStage.BeforeDeserialize: CopyStream(_oldStream, _newStream); _result.ResponseXml = GetXml(_newStream); break; case SoapMessageStage.AfterDeserialize: TimerResult dt = GlimpseManager.GetExecutionTimer().Stop(_timer); bool hasError = (message.Exception != null); object retVal; if (hasError) { retVal = message.Exception; } else if (message.MethodInfo.IsVoid) { retVal = "The SOAP call is to a void method"; } else { retVal = message.GetReturnValue(); } _result.Url = message.Url; _result.Method = message.MethodInfo.Name + (hasError ? " - ERROR" : ""); _result.ResponseResult = retVal; _result.Duration = dt.Duration.Milliseconds + "ms"; _result.Stacktrace = new StackTrace(4, true).ToString(); GlimpseManager.LogMessage(_result); var timeline = new SoapTimelineMessage(); timeline.EventName = message.MethodInfo.Name + (hasError ? " - ERROR" : ""); timeline.EventSubText = message.Url + "\n" + retVal; timeline.Offset = dt.Offset; timeline.Duration = dt.Duration; timeline.StartTime = dt.StartTime; timeline.EventCategory = SoapTimelineCategory; GlimpseManager.LogMessage(timeline); break; } }
public GlimpseSoapExtension() { if (GlimpseManager.IsGlimpseActive()) { _timer = GlimpseManager.GetExecutionTimer().Start(); } }
public override Stream ChainStream(Stream stream) { if (GlimpseManager.IsGlimpseActive() == false) { return(stream); } _oldStream = stream; _newStream = new MemoryStream(); return(_newStream); }
public static void LogMessage <T>(T message) { GlimpseRuntime runtime = GlimpseManager.GetRuntime(); if (runtime == null || runtime.IsInitialized == false) { return; } if (runtime.Configuration == null || runtime.Configuration.MessageBroker == null) { return; } var messageBroker = runtime.Configuration.MessageBroker; messageBroker.Publish(message); }
public static bool IsGlimpseActive() { GlimpseRuntime runtime = GlimpseManager.GetRuntime(); if (runtime == null || runtime.IsInitialized == false) { return(false); } if (HttpContext.Current.Items.Contains(GlimpseItemKey) == false) { return(false); } var runtimePolicy = (RuntimePolicy)HttpContext.Current.Items["__GlimpseRequestRuntimePermissions"]; return(runtimePolicy == RuntimePolicy.On); }