internal ServerProtocol Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, out bool abortProcessing)
        {
            ServerProtocol protocol = null;

            abortProcessing = false;
            protocol        = this.CreateIfRequestCompatible(request);
            try
            {
                if (protocol != null)
                {
                    protocol.SetContext(type, context, request, response);
                }
                return(protocol);
            }
            catch (Exception exception)
            {
                abortProcessing = true;
                if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
                {
                    throw;
                }
                if (Tracing.On)
                {
                    Tracing.ExceptionCatch(TraceEventType.Warning, this, "Create", exception);
                }
                if ((protocol != null) && !protocol.WriteException(exception, protocol.Response.OutputStream))
                {
                    throw new InvalidOperationException(Res.GetString("UnableToHandleRequest0"), exception);
                }
                return(null);
            }
        }
예제 #2
0
        internal ServerProtocol Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, out bool abortProcessing)
        {
            ServerProtocol serverProtocol = null;

            abortProcessing = false;
            try {
                serverProtocol = CreateIfRequestCompatible(request);
                if (serverProtocol != null)
                {
                    serverProtocol.SetContext(type, context, request, response);
                }
                return(serverProtocol);
            }
            catch (Exception e) {
                abortProcessing = true;
                if (serverProtocol != null)
                {
                    // give the protocol a shot at handling the error in a custom way
                    if (!serverProtocol.WriteException(e, serverProtocol.Response.OutputStream))
                    {
                        throw new InvalidOperationException(Res.GetString(Res.UnableToHandleRequest0), e);
                    }
                }
                return(null);
            }
        }
예제 #3
0
        internal ServerProtocol Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, out bool abortProcessing)
        {
            ServerProtocol serverProtocol = null;

            abortProcessing = false;
            serverProtocol  = CreateIfRequestCompatible(request);
            try {
                if (serverProtocol != null)
                {
                    serverProtocol.SetContext(type, context, request, response);
                }
                return(serverProtocol);
            }
            catch (Exception e) {
                abortProcessing = true;
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
                {
                    throw;
                }
                if (Tracing.On)
                {
                    Tracing.ExceptionCatch(TraceEventType.Warning, this, "Create", e);
                }
                if (serverProtocol != null)
                {
                    // give the protocol a shot at handling the error in a custom way
                    if (!serverProtocol.WriteException(e, serverProtocol.Response.OutputStream))
                    {
                        throw new InvalidOperationException(Res.GetString(Res.UnableToHandleRequest0), e);
                    }
                }
                return(null);
            }
        }