private void OnVia(Uri address)
 {
     ServiceHostingEnvironment.EnsureServiceAvailable(address.LocalPath);
 }
        public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback callback, object extraData)
        {
            ServiceHostingEnvironment.SafeEnsureInitialized();

            return(new HostedHttpRequestAsyncResult(context.ApplicationInstance, this.serviceVirtualPath, true, false, callback, extraData));
        }
        public void ProcessRequest(HttpContext context)
        {
            ServiceHostingEnvironment.SafeEnsureInitialized();

            HostedHttpRequestAsyncResult.ExecuteSynchronous(context.ApplicationInstance, this.serviceVirtualPath, true, false);
        }
        public void OnDataReceived(FramingData data)
        {
            ServiceHostingEnvironment.EnsureServiceAvailable(data.To.LocalPath);

            base.Dispatch(data);
        }
예제 #5
0
        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 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);
        }