public static IAsyncResult BeginProcessRequest(object sender, EventArgs e, AsyncCallback cb, object extraData) { if (!disabled) { try { ServiceHostingEnvironment.SafeEnsureInitialized(); } catch (SecurityException exception) { disabled = true; if (DiagnosticUtility.ShouldTraceWarning) { DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Warning); } return(cachedAsyncResult); } HttpApplication application = (HttpApplication)sender; string currentExecutionFilePathExtension = application.Request.CurrentExecutionFilePathExtension; if (string.IsNullOrEmpty(currentExecutionFilePathExtension)) { return(cachedAsyncResult); } ServiceHostingEnvironment.ServiceType serviceType = ServiceHostingEnvironment.GetServiceType(currentExecutionFilePathExtension); if (serviceType == ServiceHostingEnvironment.ServiceType.Unknown) { return(cachedAsyncResult); } if (ServiceHostingEnvironment.AspNetCompatibilityEnabled) { if ((serviceType == ServiceHostingEnvironment.ServiceType.Workflow) && ServiceHostingEnvironment.IsConfigurationBasedService(application)) { IHttpHandler handler = new ServiceHttpHandlerFactory().GetHandler(application.Context, application.Request.RequestType, application.Request.RawUrl.ToString(), application.Request.PhysicalApplicationPath); application.Context.RemapHandler(handler); } return(cachedAsyncResult); } switch (serviceType) { case ServiceHostingEnvironment.ServiceType.WCF: return(new HostedHttpRequestAsyncResult(application, false, false, cb, extraData)); case ServiceHostingEnvironment.ServiceType.Workflow: return(new HostedHttpRequestAsyncResult(application, false, true, cb, extraData)); } } return(cachedAsyncResult); }
public static IAsyncResult BeginProcessRequest(object sender, EventArgs e, AsyncCallback cb, object extraData) { if (!disabled) { try { ServiceHostingEnvironment.SafeEnsureInitialized(); } catch (SecurityException exception) { disabled = true; if (DiagnosticUtility.ShouldTraceWarning) { DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Warning); } return cachedAsyncResult; } HttpApplication application = (HttpApplication) sender; string currentExecutionFilePathExtension = application.Request.CurrentExecutionFilePathExtension; if (string.IsNullOrEmpty(currentExecutionFilePathExtension)) { return cachedAsyncResult; } ServiceHostingEnvironment.ServiceType serviceType = ServiceHostingEnvironment.GetServiceType(currentExecutionFilePathExtension); if (serviceType == ServiceHostingEnvironment.ServiceType.Unknown) { return cachedAsyncResult; } if (ServiceHostingEnvironment.AspNetCompatibilityEnabled) { if ((serviceType == ServiceHostingEnvironment.ServiceType.Workflow) && ServiceHostingEnvironment.IsConfigurationBasedService(application)) { IHttpHandler handler = new ServiceHttpHandlerFactory().GetHandler(application.Context, application.Request.RequestType, application.Request.RawUrl.ToString(), application.Request.PhysicalApplicationPath); application.Context.RemapHandler(handler); } return cachedAsyncResult; } switch (serviceType) { case ServiceHostingEnvironment.ServiceType.WCF: return new HostedHttpRequestAsyncResult(application, false, false, cb, extraData); case ServiceHostingEnvironment.ServiceType.Workflow: return new HostedHttpRequestAsyncResult(application, false, true, cb, extraData); } } return cachedAsyncResult; }
static public IAsyncResult BeginProcessRequest(object sender, EventArgs e, AsyncCallback cb, object extraData) { if (ServiceHttpModule.disabled) { return GetCompletedAsyncResult(cb, extraData); } try { ServiceHostingEnvironment.SafeEnsureInitialized(); } catch (SecurityException exception) { ServiceHttpModule.disabled = true; DiagnosticUtility.TraceHandledException(exception, TraceEventType.Warning); // If requesting a .svc file, the HttpHandler will try to handle it. It will call // SafeEnsureInitialized() again, which will fail with the same exception (it is // idempotent on failure). This is the correct behavior. return GetCompletedAsyncResult(cb, extraData); } HttpApplication application = (HttpApplication) sender; // Check to see whether the extension is supported. string extension = application.Request.CurrentExecutionFilePathExtension; if (string.IsNullOrEmpty(extension)) { return GetCompletedAsyncResult(cb, extraData); } ServiceHostingEnvironment.ServiceType serviceType = ServiceHostingEnvironment.GetServiceType(extension); // do extension check first so that we do not need to do it in aspnetrouting/configurationbasedactivation if (serviceType == ServiceHostingEnvironment.ServiceType.Unknown) { return GetCompletedAsyncResult(cb, extraData); } // check for AspNetcompat if (ServiceHostingEnvironment.AspNetCompatibilityEnabled) { // remap httphandler for xamlx in CBA, since there is No physical file and // the xamlx httphandlerfactory will do file exist checking if (serviceType == ServiceHostingEnvironment.ServiceType.Workflow && ServiceHostingEnvironment.IsConfigurationBasedService(application)) { IHttpHandler cbaHandler = new ServiceHttpHandlerFactory().GetHandler( application.Context, application.Request.RequestType, application.Request.RawUrl.ToString(), application.Request.PhysicalApplicationPath); application.Context.RemapHandler(cbaHandler); } return GetCompletedAsyncResult(cb, extraData); } if (serviceType == ServiceHostingEnvironment.ServiceType.WCF) { return new HostedHttpRequestAsyncResult(application, false, false, cb, extraData); } if (serviceType == ServiceHostingEnvironment.ServiceType.Workflow) { return new HostedHttpRequestAsyncResult(application, false, true, cb, extraData); } return GetCompletedAsyncResult(cb, extraData); }
static public IAsyncResult BeginProcessRequest(object sender, EventArgs e, AsyncCallback cb, object extraData) { if (ServiceHttpModule.disabled) { return(GetCompletedAsyncResult(cb, extraData)); } try { ServiceHostingEnvironment.SafeEnsureInitialized(); } catch (SecurityException exception) { ServiceHttpModule.disabled = true; DiagnosticUtility.TraceHandledException(exception, TraceEventType.Warning); // If requesting a .svc file, the HttpHandler will try to handle it. It will call // SafeEnsureInitialized() again, which will fail with the same exception (it is // idempotent on failure). This is the correct behavior. return(GetCompletedAsyncResult(cb, extraData)); } HttpApplication application = (HttpApplication)sender; // Check to see whether the extension is supported. string extension = application.Request.CurrentExecutionFilePathExtension; if (string.IsNullOrEmpty(extension)) { return(GetCompletedAsyncResult(cb, extraData)); } ServiceHostingEnvironment.ServiceType serviceType = ServiceHostingEnvironment.GetServiceType(extension); // do extension check first so that we do not need to do it in aspnetrouting/configurationbasedactivation if (serviceType == ServiceHostingEnvironment.ServiceType.Unknown) { return(GetCompletedAsyncResult(cb, extraData)); } // check for AspNetcompat if (ServiceHostingEnvironment.AspNetCompatibilityEnabled) { // remap httphandler for xamlx in CBA, since there is No physical file and // the xamlx httphandlerfactory will do file exist checking if (serviceType == ServiceHostingEnvironment.ServiceType.Workflow && ServiceHostingEnvironment.IsConfigurationBasedService(application)) { IHttpHandler cbaHandler = new ServiceHttpHandlerFactory().GetHandler( application.Context, application.Request.RequestType, application.Request.RawUrl.ToString(), application.Request.PhysicalApplicationPath); application.Context.RemapHandler(cbaHandler); } return(GetCompletedAsyncResult(cb, extraData)); } if (serviceType == ServiceHostingEnvironment.ServiceType.WCF) { return(new HostedHttpRequestAsyncResult(application, false, false, cb, extraData)); } if (serviceType == ServiceHostingEnvironment.ServiceType.Workflow) { return(new HostedHttpRequestAsyncResult(application, false, true, cb, extraData)); } return(GetCompletedAsyncResult(cb, extraData)); }