public override void ProcessRequest(ref System.ServiceModel.Channels.RequestContext requestContext) { if (Trace.CorrelationManager.ActivityId == Guid.Empty) { Trace.CorrelationManager.ActivityId = Guid.NewGuid(); } var request = requestContext.RequestMessage; if (endpointFilter == null || endpointFilter(request)) { try { IPrincipal principal = ExtractCredentials(request); if (principal != null) { InitializeSecurityContext(request, principal); } else { var reply = Message.CreateMessage(MessageVersion.None, null); var responseProperty = new HttpResponseMessageProperty() { StatusCode = HttpStatusCode.Unauthorized }; if (sendChallenge) { var ts = Hawk.ConvertToUnixTimestamp(DateTime.Now).ToString(); var challenge = string.Format("ts=\"{0}\" ntp=\"{1}\"", ts, "pool.ntp.org"); responseProperty.Headers.Add("WWW-Authenticate", challenge); } reply.Properties[HttpResponseMessageProperty.Name] = responseProperty; requestContext.Reply(reply); requestContext = null; } } catch (SecurityException ex) { TraceSource.TraceData(TraceEventType.Error, 0, string.Format("{0} - Security Exception {1}", Trace.CorrelationManager.ActivityId, ex.ToString())); var reply = Message.CreateMessage(MessageVersion.None, null, (object)ex.Message); var responseProperty = new HttpResponseMessageProperty() { StatusCode = HttpStatusCode.Unauthorized }; reply.Properties[HttpResponseMessageProperty.Name] = responseProperty; requestContext.Reply(reply); requestContext = null; } } }
public override void ProcessRequest(ref RequestContext requestContext) { if (requestContext == null || requestContext.RequestMessage == null) { return; } Message request = requestContext.RequestMessage; var requestProperty = (HttpRequestMessageProperty) request.Properties[HttpRequestMessageProperty.Name]; IOAuthContext context = new OAuthContextBuilder().FromUri(requestProperty.Method, request.Headers.To); try { _provider.AccessProtectedResourceRequest(context); AccessToken accessToken = _repository.GetToken(context.Token); TokenPrincipal principal = CreatePrincipalFromToken(accessToken); InitializeSecurityContext(request, principal); } catch (OAuthException authEx) { XElement response = GetHtmlFormattedErrorReport(authEx); Message reply = Message.CreateMessage(MessageVersion.None, null, response); var responseProperty = new HttpResponseMessageProperty {StatusCode = HttpStatusCode.Forbidden, StatusDescription = authEx.Report.ToString()}; responseProperty.Headers[HttpResponseHeader.ContentType] = "text/html"; reply.Properties[HttpResponseMessageProperty.Name] = responseProperty; requestContext.Reply(reply); requestContext = null; } }
public SecurityRequestContext (SecurityReplyChannel channel, RequestContext source) { this.source = source; this.channel = channel; security = channel.Source.SecuritySupport; }
private void DisposeRequestContext(System.ServiceModel.Channels.RequestContext context) { try { context.Close(); ReceiveContextRPCFacet receiveContext = this.ReceiveContext; if (receiveContext != null) { this.ReceiveContext = null; CallbackState state = new CallbackState { ChannelHandler = this.channelHandler, ReceiveContext = receiveContext }; IAsyncResult result = receiveContext.BeginComplete(TimeSpan.MaxValue, null, this.channelHandler, handleEndComplete, state); if (result.CompletedSynchronously) { receiveContext.EndComplete(result); } } } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } this.AbortRequestContext(context); this.channelHandler.HandleError(exception); } }
public HttpMessageEncodingRequestContext(RequestContext innerContext) { Debug.Assert(innerContext != null, "The 'innerContext' parameter should not be null."); this.innerContext = innerContext; this.isRequestConfigured = false; this.requestConfigurationLock = new object(); }
private void AbortRequestContext(System.ServiceModel.Channels.RequestContext requestContext) { try { requestContext.Abort(); ReceiveContextRPCFacet receiveContext = this.ReceiveContext; if (receiveContext != null) { this.ReceiveContext = null; CallbackState state = new CallbackState { ReceiveContext = receiveContext, ChannelHandler = this.channelHandler }; IAsyncResult result = receiveContext.BeginAbandon(TimeSpan.MaxValue, handleEndAbandon, state); if (result.CompletedSynchronously) { receiveContext.EndAbandon(result); } } } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } this.channelHandler.HandleError(exception); } }
public override void ProcessRequest(ref RequestContext requestContext) { if (!IsValidUserKey(requestContext)) { GenerateErrorResponse(ref requestContext, HttpStatusCode.Unauthorized, "Unauthorized"); } }
public MessageProcessingContext (OperationContext opCtx) { operation_context = opCtx; request_context = opCtx.RequestContext; incoming_message = opCtx.IncomingMessage; user_events_handler = new UserEventsHandler (this); }
public override void ProcessRequest(ref RequestContext requestContext) { if (requestContext == null || !authenticationManager.AuthenticateRequest(requestContext.RequestMessage)) { requestContext = CreateAndSendInvalidAuthenticationRequest(requestContext); } }
/// <summary cref="IReplyChannel.TryReceiveRequest" /> public bool TryReceiveRequest(TimeSpan timeout, out System.ServiceModel.Channels.RequestContext context) { ThrowIfDisposedOrNotOpen(); IAsyncResult result = BeginTryReceiveRequest(timeout, null, null); return(EndTryReceiveRequest(result, out context)); }
public override void ProcessRequest(ref RequestContext requestContext) { if (!manager.AuthenticateRequest(requestContext.RequestMessage)) { requestContext.Reply(manager.CreateInvalidAuthenticationRequest()); requestContext = null; } }
public bool IsValidUserKey(RequestContext requestContext) { if (requestContext != null && requestContext.RequestMessage != null) { var prop = (HttpRequestMessageProperty)requestContext.RequestMessage.Properties[HttpRequestMessageProperty.Name]; var cookie = prop.Headers[HttpRequestHeader.Cookie]; if (string.IsNullOrEmpty(cookie)) return false; var coockieName = CookiesManager.GetCookiesName(); foreach (string s in cookie.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { if (s.IndexOf('=') == -1) continue; var key = s.Substring(0, s.IndexOf('=')).Trim(); if (key.Equals(coockieName, StringComparison.Ordinal)) { try { var value = s.Substring(s.IndexOf('=') + 1).Trim(); if (SecurityContext.IsAuthenticated || SecurityContext.AuthenticateMe(value)) { return true; } } catch { } break; } } } return false; }
private void ProcessRequestContext(ChannelContext channelContext, System.ServiceModel.Channels.RequestContext requestContext) { Contract.Assert(channelContext != null); Contract.Assert(requestContext != null); HttpRequestMessage request = null; try { // Get the HTTP request from the WCF Message request = requestContext.RequestMessage.ToHttpRequestMessage(); if (request == null) { throw Error.InvalidOperation(SRResources.HttpMessageHandlerInvalidMessage, requestContext.RequestMessage.GetType()); } // create principal information and add it the request for the windows auth case SetCurrentPrincipal(request); // Add the retrieve client certificate delegate to the property bag to enable lookup later on request.Properties.Add(HttpPropertyKeys.RetrieveClientCertificateDelegateKey, _retrieveClientCertificate); // Add information about whether the request is local or not request.Properties.Add(HttpPropertyKeys.IsLocalKey, new Lazy <bool>(() => IsLocal(requestContext.RequestMessage))); // Submit request up the stack HttpResponseMessage responseMessage = null; channelContext.Server.SendAsync(request, channelContext.Server._cancellationTokenSource.Token) .Then(response => { responseMessage = response ?? request.CreateResponse(HttpStatusCode.InternalServerError); }) .Catch(info => { responseMessage = request.CreateErrorResponse(HttpStatusCode.InternalServerError, info.Exception); return(info.Handled()); }) .Finally(() => { if (responseMessage == null) // No Then or Catch, must've been canceled { responseMessage = request.CreateErrorResponse(HttpStatusCode.ServiceUnavailable, SRResources.RequestCancelled); } Message reply = responseMessage.ToMessage(); BeginReply(new ReplyContext(channelContext, requestContext, reply)); }); } catch (Exception e) { HttpResponseMessage response = request != null? request.CreateErrorResponse(HttpStatusCode.InternalServerError, e) : new HttpResponseMessage(HttpStatusCode.BadRequest); Message reply = response.ToMessage(); BeginReply(new ReplyContext(channelContext, requestContext, reply)); } }
internal OperationContext(System.ServiceModel.Channels.RequestContext requestContext, Message request, ServiceChannel channel, ServiceHostBase host) { this.channel = channel; this.host = host; this.requestContext = requestContext; this.request = request; this.outgoingMessageVersion = channel.MessageVersion; }
public MessageProcessingContext (OperationContext opCtx, IChannel replyOrInput) { operation_context = opCtx; request_context = opCtx.RequestContext; incoming_message = opCtx.IncomingMessage; user_events_handler = new UserEventsHandler (this); reply_or_input = replyOrInput; }
public void NotifyInvokeReceived(RequestContext request) { using (ServiceModelActivity.BoundOperation(this.activity)) { ChannelHandler.Register(this.handler, request); } this.DidInvokerEnsurePump = true; }
private RequestContext CreateAndSendInvalidAuthenticationRequest(RequestContext requestContext) { using (Message responseMessage = authenticationManager.CreateInvalidAuthenticationRequest(requestContext.RequestMessage)) { requestContext.Reply(responseMessage); requestContext = null; return requestContext; } }
public HttpCookieSessionRequestContext( RequestContext innerRequestContext, string sessionId, bool isInitial) { this.sessionId = sessionId; this.innerRequestContext = innerRequestContext; this.isInitial = isInitial; }
internal void Recycle() { this.requestContext = null; this.request = null; this.extensions = null; this.instanceContext = null; this.threadPrincipal = null; this.txFacet = null; this.SetClientReply(null, false); }
public SelfHostHttpRequestContext(RequestContext requestContext, HttpConfiguration configuration, HttpRequestMessage request) { Contract.Assert(requestContext != null); Contract.Assert(configuration != null); Contract.Assert(request != null); _requestContext = requestContext; _configuration = configuration; _request = request; }
public bool EndTryReceiveRequest(IAsyncResult result, out RequestContext context) { Task<RequestContext> task = (Task<RequestContext>) result; task.Wait(); context = task.Result; return context != null; }
public bool EndTryReceiveRequest(IAsyncResult result, out RequestContext context) { _innerChannel.EndTryReceiveRequest(result, out context); var timeout = ((IDefaultCommunicationTimeouts)this.Manager).ReceiveTimeout; context = ProcessContext(context, timeout); return context != null; }
/// <summary cref="IReplyChannel.ReceiveRequest(TimeSpan)" /> public System.ServiceModel.Channels.RequestContext ReceiveRequest(TimeSpan timeout) { System.ServiceModel.Channels.RequestContext context = null; if (!TryReceiveRequest(timeout, out context)) { throw new TimeoutException(); } return(context); }
/// <summary cref="IReplyChannel.EndReceiveRequest" /> public System.ServiceModel.Channels.RequestContext EndReceiveRequest(IAsyncResult result) { System.ServiceModel.Channels.RequestContext context = null; if (!EndTryReceiveRequest(result, out context)) { throw new TimeoutException(); } return(context); }
public bool EndTryReceive(IAsyncResult result, out RequestContext requestContext) { Message message; if (this.channel.EndTryReceive(result, out message)) { requestContext = this.WrapMessage(message); return true; } requestContext = null; return false; }
public static void Unauthorized(ref RequestContext context, string nonauthorizedHeaderValue) { var reply = Message.CreateMessage(MessageVersion.None, null); var responseProperty = new HttpResponseMessageProperty() { StatusCode = HttpStatusCode.Unauthorized }; responseProperty.Headers.Add(HttpResponseHeader.WwwAuthenticate, nonauthorizedHeaderValue); reply.Properties[HttpResponseMessageProperty.Name] = responseProperty; context.Reply(reply); context = null; }
public AzureServiceBusHttpRequest(RequestContext context) { _context = context; _request = _context.RequestMessage; _requestProperties = _context.RequestMessage.Properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty; _serverVariables = new NameValueCollection(); Uri via = _request.Properties.Via; _serverVariables.Add("SERVER_NAME", via.Host); _serverVariables.Add("SERVER_PORT", via.Port.ToString()); _serverVariables.Add("SERVER_PROTOCOL", via.Scheme); }
public bool EndTryReceive(IAsyncResult result, out RequestContext requestContext) { RequestContextWrapper wrapper; bool flag = this.inputQueue.EndDequeue(result, out wrapper); if (flag && (wrapper != null)) { requestContext = wrapper.RequestContext; return flag; } requestContext = null; return flag; }
public override void ProcessRequest(ref System.ServiceModel.Channels.RequestContext requestContext) { Message request = requestContext.RequestMessage; HttpRequestMessageProperty requestProp = (HttpRequestMessageProperty)request.Properties[HttpRequestMessageProperty.Name]; if (bool.Parse(AppSettings.GetAbsolute("CheckSession")) == true) { Message reply; reply = Message.CreateMessage(MessageVersion.None, null); HttpResponseMessageProperty responseProp = new HttpResponseMessageProperty() { StatusCode = HttpStatusCode.Unauthorized }; if (requestContext == null || requestContext.RequestMessage == null) { return; } NameValueCollection queryParams = HttpUtility.ParseQueryString(requestProp.QueryString); if (request.Properties.Via.LocalPath.ToUpper() != LogInMessageAdress.ToUpper()) { if (requestProp.Headers[SessionHeader] == null) //case header not specified { responseProp.StatusDescription = ("You have not specified session header"); responseProp.Headers[HttpResponseHeader.ContentType] = "text/html"; reply.Properties[HttpResponseMessageProperty.Name] = responseProp; requestContext.Reply(reply); // set the request context to null to terminate processing of this request requestContext = null; } else { string session = requestProp.Headers[SessionHeader]; int userCode; if (!IsSessionValid(session, out userCode)) //if session is valid { responseProp.StatusCode = HttpStatusCode.Unauthorized; responseProp.StatusDescription = ("session is not exist or out of date"); responseProp.Headers[HttpResponseHeader.ContentType] = "text/html"; reply.Properties[HttpResponseMessageProperty.Name] = responseProp; requestContext.Reply(reply); // set the request context to null to terminate processing of this request requestContext = null; } else { requestProp.Headers.Add("xUserCode", "userCode"); } } } } }
public ReplyChannelDemuxFailureAsyncResult(IChannelDemuxFailureHandler demuxFailureHandler, RequestContext requestContext, AsyncCallback callback, object state) : base(callback, state) { if (demuxFailureHandler == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("demuxFailureHandler"); } if (requestContext == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("requestContext"); } this.demuxFailureHandler = demuxFailureHandler; this.requestContext = requestContext; }
public bool EndTryReceiveRequest(IAsyncResult result, out RequestContext context) { bool requestAvailable = innerReplySessionChannel.EndTryReceiveRequest(result, out context); if (requestAvailable && context != null) { ReadAndAddContextIdToMessage(context.RequestMessage); } return requestAvailable; }
public bool EndTryReceiveRequest(IAsyncResult result, out RequestContext context) { bool requestAvailable = innerReplyChannel.EndTryReceiveRequest(result, out context); if (requestAvailable) { // Read the context id from the incoming message. ReadContextId(context.RequestMessage); } return requestAvailable; }
public bool TryReceiveRequest(TimeSpan timeout, out RequestContext context) { try { context = this.ReceiveRequest(timeout); return true; } catch (TimeoutException) { context = null; return false; } }
public override void ProcessRequest(ref RequestContext requestContext) { if (requestContext == null) return; var request = requestContext.RequestMessage; if (request == null) return; var prop = (HttpRequestMessageProperty)request.Properties[HttpRequestMessageProperty.Name]; string format = null; string accepts = prop.Headers[HttpRequestHeader.Accept]; if (accepts != null) { if (accepts.Contains("text/xml") || accepts.Contains("application/xml")) { format = "xml"; } else if (accepts.Contains("application/json")) { format = "json"; } } else { string contentType = prop.Headers[HttpRequestHeader.ContentType]; if (contentType != null) { if (contentType.Contains("text/xml") || contentType.Contains("application/xml")) { format = "xml"; } else if (contentType.Contains("application/json")) { format = "json"; } } } if (format != null) { var toBuilder = new UriBuilder(request.Headers.To); if (string.IsNullOrEmpty(toBuilder.Query)) { toBuilder.Query = "format=" + format; } else if (!toBuilder.Query.Contains("format=")) { toBuilder.Query += "&format=" + format; } request.Headers.To = toBuilder.Uri; } }
public ContextChannelRequestContext(RequestContext innerContext, ContextProtocol contextProtocol, TimeSpan defaultSendTimeout) { if (innerContext == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("innerContext"); } if (contextProtocol == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("contextProtocol"); } this.innerContext = innerContext; this.contextProtocol = contextProtocol; this.defaultSendTimeout = defaultSendTimeout; }
private static bool EndTryReceiveRequestContext( IAsyncResult result, out System.ServiceModel.Channels.RequestContext requestContext ) { Contract.Assert(result != null); CompletedAsyncResult <bool> handlerResult = result as CompletedAsyncResult <bool>; if (handlerResult != null) { requestContext = null; return(CompletedAsyncResult <bool> .End(handlerResult)); } else { try { ChannelContext channelContext = (ChannelContext)result.AsyncState; Contract.Assert(channelContext != null, "context cannot be null"); return(channelContext.Channel.EndTryReceiveRequest(result, out requestContext)); } catch (CommunicationObjectAbortedException) { requestContext = null; return(true); } catch (CommunicationObjectFaultedException) { requestContext = null; return(true); } catch (CommunicationException) { requestContext = null; return(false); } catch (TimeoutException) { requestContext = null; return(false); } catch { requestContext = null; return(false); } } }
public void ProcessDemuxedRequest(RequestContext context, WsrmMessageInfo info) { try { this.ProcessRequest(context, info); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } base.ReliableSession.OnUnknownException(exception); } }
/// <summary> /// Processes the request. /// </summary> /// <param name="requestContext">The request context.</param> public override void ProcessRequest(ref RequestContext requestContext) { var httpRequest = requestContext.RequestMessage.GetHttpRequestMessage(); var basicToken = ExtractToken(httpRequest); if (basicToken != null && AuthenticateUser(basicToken)) { SecurityContextManager.InitializeSecurityContext(requestContext.RequestMessage, basicToken.Username); } else { RequestContextUtils.Unauthorized(ref requestContext, String.Format("Basic realm=\"{0}\"", Realm)); } }
private bool AuthenticateUser(string p_UserName, string p_Password, RequestContext p_RequestContext) { try { var l_PassHash = ""; using (var l_SelectQuery = new DatabaseQuery(Database.Connection, true)) { l_SelectQuery.AppendLine("SELECT PassHash"); l_SelectQuery.AppendLine(" FROM Periscopix.dbo.prscpxUsers"); l_SelectQuery.AppendLine(" WHERE Company = 1 AND UserName = @Username"); l_SelectQuery.AddWithValue("@Username", p_UserName); using (var l_Reader = new ExDataReader(l_SelectQuery.ExecuteReader())) { if (l_Reader.Read()) { l_PassHash = l_Reader.GetString(); } } } var l_Success = BCrypt.CheckPassword(p_Password, l_PassHash); if (l_Success) { CreateSuccessReply(ref p_RequestContext, l_PassHash); } return true; } catch { return false; } }
// Locking: // Only 1 channelBinder operation call should be active at any given time. All future calls // will wait on the inputQueue. The semaphore is always released right before the Dispatch on the inputQueue. // This protects a new call racing with an existing operation that is just about to fully complete. public bool TryReceive(TimeSpan timeout, out RequestContext requestContext) { if (Interlocked.CompareExchange(ref _pendingOperationSemaphore, 1, 0) == 0) { ActionItem.Schedule(s_tryReceive, this); } RequestContextWrapper wrapper; bool success = _inputQueue.Dequeue(timeout, out wrapper); if (success && wrapper != null) { requestContext = wrapper.RequestContext; } else { requestContext = null; } return success; }
/// <summary cref="IReplyChannel.EndTryReceiveRequest" /> public bool EndTryReceiveRequest(IAsyncResult result, out System.ServiceModel.Channels.RequestContext context) { context = null; TcpAsyncOperation <RequestContext> operation = (TcpAsyncOperation <RequestContext>)result; try { context = operation.End(Int32.MaxValue); return(true); } catch (TimeoutException) { return(false); } catch (Exception e) { m_fault = ServiceResult.Create(e, StatusCodes.BadInternalError, "Could not receive request from a UA TCP channel."); Utils.Trace(m_fault.ToLongString()); return(false); } }
public override void ProcessRequest(ref RequestContext requestContext) { string[] credentials = ExtractCredentials(requestContext.RequestMessage); if (credentials.Length > 0 && AuthenticateUser(credentials[0], credentials[1])) { InitializeSecurityContext(requestContext.RequestMessage, credentials[0]); } else { Message reply = Message.CreateMessage(MessageVersion.None, null); HttpResponseMessageProperty responseProperty = new HttpResponseMessageProperty() { StatusCode = HttpStatusCode.Unauthorized }; responseProperty.Headers.Add("WWW-Authenticate", String.Format("Basic realm=\"{0}\"", Realm)); reply.Properties[HttpResponseMessageProperty.Name] = responseProperty; requestContext.Reply(reply); requestContext = null; } }
public BufferedRequestContext(RequestContext requestContext) { this.innerRequestContext = requestContext; this.thisLock = new object(); }
public static bool End(IAsyncResult result, out System.ServiceModel.Channels.RequestContext context) { MultipleReceiveBinder.MultipleReceiveAsyncResult result2 = AsyncResult.End <MultipleReceiveBinder.MultipleReceiveAsyncResult>(result); context = result2.RequestContext; return(result2.Valid); }
public abstract void OnOutgoingMessage(Message message, RequestContext requestContext);
internal void ReInit(System.ServiceModel.Channels.RequestContext requestContext, Message request, ServiceChannel channel) { this.requestContext = requestContext; this.request = request; this.channel = channel; }
public RequestContextMessageProperty(RequestContext context) { _context = context; }
protected override void ProcessSequencedItem(ReliableReplySessionChannel reliableChannel, RequestContext context, WsrmMessageInfo info) { reliableChannel.ProcessDemuxedRequest(reliableChannel.Binder.WrapRequestContext(context), info); }
private static void ProcessRequestContext(ChannelContext channelContext, System.ServiceModel.Channels.RequestContext requestContext) { Contract.Assert(channelContext != null); Contract.Assert(requestContext != null); // Get the HTTP request from the WCF Message HttpRequestMessage request = requestContext.RequestMessage.ToHttpRequestMessage(); if (request == null) { throw Error.InvalidOperation(SRResources.HttpMessageHandlerInvalidMessage, requestContext.RequestMessage.GetType()); } // create principal information and add it the request for the windows auth case SecurityMessageProperty property; if (request.Properties.TryGetValue <SecurityMessageProperty>(SecurityKey, out property)) { ServiceSecurityContext context = property.ServiceSecurityContext; if (context != null && context.PrimaryIdentity != null) { WindowsIdentity windowsIdentity = context.PrimaryIdentity as WindowsIdentity; if (windowsIdentity != null) { Thread.CurrentPrincipal = new WindowsPrincipal(windowsIdentity); } } } // Submit request up the stack try { HttpResponseMessage responseMessage = null; channelContext.Server.SendAsync(request, channelContext.Server._cancellationTokenSource.Token) .Then(response => { responseMessage = response ?? request.CreateResponse(HttpStatusCode.OK); }) .Catch(info => { // REVIEW: Shouldn't the response contain the exception so it can be serialized? responseMessage = request.CreateResponse(HttpStatusCode.InternalServerError); return(info.Handled()); }) .Finally(() => { if (responseMessage == null) // No Then or Catch, must've been canceled { responseMessage = request.CreateResponse(HttpStatusCode.ServiceUnavailable); } Message reply = responseMessage.ToMessage(); BeginReply(new ReplyContext(channelContext, requestContext, reply)); }); } catch { // REVIEW: Shouldn't the response contain the exception so it can be serialized? HttpResponseMessage response = request.CreateResponse(HttpStatusCode.InternalServerError); Message reply = response.ToMessage(); BeginReply(new ReplyContext(channelContext, requestContext, reply)); } }
internal MessageRpc(System.ServiceModel.Channels.RequestContext requestContext, Message request, DispatchOperationRuntime operation, ServiceChannel channel, ServiceHostBase host, ChannelHandler channelHandler, bool cleanThread, System.ServiceModel.OperationContext operationContext, System.ServiceModel.InstanceContext instanceContext) { this.Activity = null; this.AsyncResult = null; this.CanSendReply = true; this.Channel = channel; this.channelHandler = channelHandler; this.Correlation = EmptyArray.Allocate(operation.Parent.CorrelationCount); this.CorrelationCallback = null; this.DidDeserializeRequestBody = false; this.TransactionMessageProperty = null; this.TransactedBatchContext = null; this.Error = null; this.ErrorProcessor = null; this.FaultInfo = new ErrorHandlerFaultInfo(request.Version.Addressing.DefaultFaultAction); this.HasSecurityContext = false; this.Host = host; this.Instance = null; this.MessageRpcOwnsInstanceContextThrottle = false; this.NextProcessor = null; this.NotUnderstoodHeaders = null; this.Operation = operation; this.OperationContext = operationContext; this.paused = false; this.ParametersDisposed = false; this.ReceiveContext = null; this.Request = request; this.RequestContext = requestContext; this.RequestContextThrewOnReply = false; this.SuccessfullySendReply = false; this.RequestVersion = request.Version; this.Reply = null; this.ReplyTimeoutHelper = new TimeoutHelper(); this.SecurityContext = null; this.InstanceContext = instanceContext; this.SuccessfullyBoundInstance = false; this.SuccessfullyIncrementedActivity = false; this.SuccessfullyLockedInstance = false; this.switchedThreads = !cleanThread; this.transaction = null; this.InputParameters = null; this.OutputParameters = null; this.ReturnParameter = null; this.isInstanceContextSingleton = InstanceContextProviderBase.IsProviderSingleton(this.Channel.DispatchRuntime.InstanceContextProvider); this.invokeContinueGate = null; if (!operation.IsOneWay && !operation.Parent.ManualAddressing) { this.RequestID = request.Headers.MessageId; this.ReplyToInfo = new System.ServiceModel.Channels.RequestReplyCorrelator.ReplyToInfo(request); } else { this.RequestID = null; this.ReplyToInfo = new System.ServiceModel.Channels.RequestReplyCorrelator.ReplyToInfo(); } this.HostingProperty = AspNetEnvironment.Current.PrepareMessageForDispatch(request); if (DiagnosticUtility.ShouldUseActivity) { this.Activity = TraceUtility.ExtractActivity(this.Request); } if (DiagnosticUtility.ShouldUseActivity || TraceUtility.ShouldPropagateActivity) { this.ResponseActivityId = ActivityIdHeader.ExtractActivityId(this.Request); } else { this.ResponseActivityId = Guid.Empty; } this.InvokeNotification = new MessageRpcInvokeNotification(this.Activity, this.channelHandler); }
public RequestContextWrapper(System.ServiceModel.Channels.RequestContext requestContext) { this.RequestContext = requestContext; }