private static void ProcessRequest(object sender, EventArgs e) { if (!disabled) { try { ServiceHostingEnvironment.SafeEnsureInitialized(); } catch (SecurityException exception) { disabled = true; if (DiagnosticUtility.ShouldTraceWarning) { DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Warning); } return; } HttpApplication application = (HttpApplication)sender; string currentExecutionFilePathExtension = application.Request.CurrentExecutionFilePathExtension; if (!string.IsNullOrEmpty(currentExecutionFilePathExtension)) { ServiceHostingEnvironment.ServiceType serviceType = ServiceHostingEnvironment.GetServiceType(currentExecutionFilePathExtension); if (serviceType != ServiceHostingEnvironment.ServiceType.Unknown) { if (ServiceHostingEnvironment.AspNetCompatibilityEnabled) { if ((serviceType == ServiceHostingEnvironment.ServiceType.Workflow) && ServiceHostingEnvironment.IsConfigurationBasedService(application)) { application.Context.RemapHandler(new HttpHandler()); } } else { switch (serviceType) { case ServiceHostingEnvironment.ServiceType.WCF: HostedHttpRequestAsyncResult.ExecuteSynchronous(application, false, false); return; case ServiceHostingEnvironment.ServiceType.Workflow: HostedHttpRequestAsyncResult.ExecuteSynchronous(application, false, true); break; } } } } } }
public void ProcessRequest(HttpContext context) { ServiceHostingEnvironment.SafeEnsureInitialized(); HostedHttpRequestAsyncResult.ExecuteSynchronous(context.ApplicationInstance, this.serviceVirtualPath, true, false); }
static void ProcessRequest(object sender, EventArgs e) { if (HttpModule.disabled) { return; } try { ServiceHostingEnvironment.SafeEnsureInitialized(); } catch (SecurityException exception) { HttpModule.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; } HttpApplication application = (HttpApplication)sender; // Check to see whether the extension is supported string extension = application.Request.CurrentExecutionFilePathExtension; if (string.IsNullOrEmpty(extension)) { return; } 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; } // 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)) { application.Context.RemapHandler(new HttpHandler()); } return; } else if (serviceType == ServiceHostingEnvironment.ServiceType.WCF) { HostedHttpRequestAsyncResult.ExecuteSynchronous(application, false, false); } else if (serviceType == ServiceHostingEnvironment.ServiceType.Workflow) { HostedHttpRequestAsyncResult.ExecuteSynchronous(application, false, true); } }