Esempio n. 1
0
        public HostedHttpRequestAsyncResult(HttpApplication context, string aspNetRouteServiceVirtualPath, bool flowContext, bool ensureWFService, AsyncCallback callback, object state) : base(callback, state)
        {
            if (context == null)
            {
                throw System.ServiceModel.Activation.FxTrace.Exception.ArgumentNull("context");
            }
            this.context     = context;
            this.flowContext = flowContext;
            if (ensureWFService)
            {
                if (ServiceHostingEnvironment.IsConfigurationBasedService(context, out this.configurationBasedServiceVirtualPath))
                {
                    this.ensureWFService = false;
                }
                else
                {
                    this.ensureWFService = true;
                }
            }
            if (!string.IsNullOrEmpty(aspNetRouteServiceVirtualPath))
            {
                if (!RouteTable.Routes.RouteExistingFiles && ServiceHostingEnvironment.IsConfigurationBasedService(context, out this.configurationBasedServiceVirtualPath))
                {
                    this.AspNetRouteServiceVirtualPath = null;
                }
                else
                {
                    this.AspNetRouteServiceVirtualPath = aspNetRouteServiceVirtualPath;
                }
            }
            string strA = context.Request.HttpMethod ?? "";
            char   ch   = (strA.Length == 5) ? strA[0] : '\0';

            if (((ch == 'd') || (ch == 'D')) && (string.Compare(strA, "DEBUG", StringComparison.OrdinalIgnoreCase) == 0))
            {
                if (DiagnosticUtility.ShouldTraceVerbose)
                {
                    System.ServiceModel.Activation.Diagnostics.TraceUtility.TraceEvent(TraceEventType.Verbose, 0x90005, System.ServiceModel.Activation.SR.TraceCodeWebHostDebugRequest, this);
                }
                this.state = 1;
                base.Complete(true, null);
            }
            else
            {
                this.impersonationContext = new HostedImpersonationContext();
                if (flowContext && ServiceHostingEnvironment.AspNetCompatibilityEnabled)
                {
                    this.hostedThreadData = new System.ServiceModel.Activation.HostedThreadData();
                }
                Action <object> action = (AspNetPartialTrustHelpers.NeedPartialTrustInvoke || flowContext) ? WaitOnBeginRequestWithFlow : WaitOnBeginRequest;
                if (!ServiceHostingEnvironment.AspNetCompatibilityEnabled && !this.ensureWFService)
                {
                    context.CompleteRequest();
                }
                context.Server.ScriptTimeout = 0x7fffffff;
                ServiceHostingEnvironment.IncrementRequestCount();
                IOThreadScheduler.ScheduleCallbackLowPriNoFlow(action, this);
            }
        }
 public HostedHttpRequestAsyncResult(HttpApplication context, string aspNetRouteServiceVirtualPath, bool flowContext, bool ensureWFService, AsyncCallback callback, object state) : base(callback, state)
 {
     if (context == null)
     {
         throw System.ServiceModel.Activation.FxTrace.Exception.ArgumentNull("context");
     }
     this.context = context;
     this.flowContext = flowContext;
     if (ensureWFService)
     {
         if (ServiceHostingEnvironment.IsConfigurationBasedService(context, out this.configurationBasedServiceVirtualPath))
         {
             this.ensureWFService = false;
         }
         else
         {
             this.ensureWFService = true;
         }
     }
     if (!string.IsNullOrEmpty(aspNetRouteServiceVirtualPath))
     {
         if (!RouteTable.Routes.RouteExistingFiles && ServiceHostingEnvironment.IsConfigurationBasedService(context, out this.configurationBasedServiceVirtualPath))
         {
             this.AspNetRouteServiceVirtualPath = null;
         }
         else
         {
             this.AspNetRouteServiceVirtualPath = aspNetRouteServiceVirtualPath;
         }
     }
     string strA = context.Request.HttpMethod ?? "";
     char ch = (strA.Length == 5) ? strA[0] : '\0';
     if (((ch == 'd') || (ch == 'D')) && (string.Compare(strA, "DEBUG", StringComparison.OrdinalIgnoreCase) == 0))
     {
         if (DiagnosticUtility.ShouldTraceVerbose)
         {
             System.ServiceModel.Activation.Diagnostics.TraceUtility.TraceEvent(TraceEventType.Verbose, 0x90005, System.ServiceModel.Activation.SR.TraceCodeWebHostDebugRequest, this);
         }
         this.state = 1;
         base.Complete(true, null);
     }
     else
     {
         this.impersonationContext = new HostedImpersonationContext();
         if (flowContext && ServiceHostingEnvironment.AspNetCompatibilityEnabled)
         {
             this.hostedThreadData = new System.ServiceModel.Activation.HostedThreadData();
         }
         Action<object> action = (AspNetPartialTrustHelpers.NeedPartialTrustInvoke || flowContext) ? WaitOnBeginRequestWithFlow : WaitOnBeginRequest;
         if (!ServiceHostingEnvironment.AspNetCompatibilityEnabled && !this.ensureWFService)
         {
             context.CompleteRequest();
         }
         context.Server.ScriptTimeout = 0x7fffffff;
         ServiceHostingEnvironment.IncrementRequestCount();
         IOThreadScheduler.ScheduleCallbackLowPriNoFlow(action, this);
     }
 }