コード例 #1
0
 internal void CreateExecutionSteps(NetHttpApplication app, ArrayList steps)
 {
     for (int i = 0; i < _count; i++)
     {
         steps.Add(new AsyncEventExecutionStep(app, (BeginEventHandler)_beginHandlers[i], (EndEventHandler)_endHandlers[i], _stateObjects[i]));
     }
 }
コード例 #2
0
 internal AsyncEventExecutionStep(NetHttpApplication app, BeginEventHandler beginHandler, EndEventHandler endHandler, object state)
 {
     _application        = app;
     _beginHandler       = beginHandler;
     _endHandler         = endHandler;
     _state              = state;
     _completionCallback = new AsyncCallback(OnAsyncEventCompletion);
 }
コード例 #3
0
 private void RecycleSpecialApplicationInstance(NetHttpApplication application)
 {
     if (_numFreeSpecialInstances < 20)
     {
         lock (_freeSpecialInstances)
         {
             _freeSpecialInstances.Push(application);
             _numFreeSpecialInstances++;
         }
     }
 }
コード例 #4
0
 internal void RecycleApplicationInstance(NetHttpApplication application)
 {
     if (_numFreeInstances < 20)
     {
         lock (_freeInstances)
         {
             _freeInstances.Push(application);
             _numFreeInstances++;
         }
     }
 }
コード例 #5
0
 internal void ClearReferences()
 {
     _appInstance = null;
     //_handler = null;
     //_handlerStack = null;
     _currentHandler = null;
     //if (_isIntegratedPipeline)
     //{
     //    _items = null;
     //    _syncContext = null;
     //}
 }
コード例 #6
0
        private NetHttpApplication GetSpecialApplicationInstance(NetHttpContext context)
        {
            NetHttpApplication application = null;

            lock (_freeSpecialInstances)
                if (_numFreeSpecialInstances > 0)
                {
                    application = (NetHttpApplication)_freeSpecialInstances.Pop();
                    _numFreeSpecialInstances--;
                }
            if (application == null)
            {
                application = (NetHttpApplication)NetHttpRuntime.CreateNonPublicInstance(_applicationType, null);
                application.InitSpecial(context, _state, this, _eventHandlerMethods);
            }
            return(application);
        }
コード例 #7
0
        internal NetHttpApplication GetApplicationInstance(NetHttpWorkerRequest wr, NetHttpContext context)
        {
            EnsureInited();
            EnsureAppStartCalled(context);
            //
            NetHttpApplication application = null;

            lock (_freeInstances)
                if (_numFreeInstances > 0)
                {
                    application = (NetHttpApplication)_freeInstances.Pop();
                    _numFreeInstances--;
                }
            if (application == null)
            {
                application = (NetHttpApplication)NetHttpRuntime.CreateNonPublicInstance(_applicationType, null);
                application.InitInternal(wr, context, _state, this, _eventHandlerMethods);
            }
            return(application);
        }
コード例 #8
0
 internal void EnsureAppStartCalledForIntegratedMode(NetHttpContext context, NetHttpApplication application)
 {
     if (!_appOnStartCalled)
     {
         Exception innerException = null;
         lock (this)
         {
             if (!_appOnStartCalled)
             {
                 if (_onStartMethod != null)
                 {
                     application.ProcessSpecialRequest(context, _onStartMethod, _onStartParamCount, this, EventArgs.Empty, null);
                 }
             }
             _appOnStartCalled = true;
             innerException    = context.Error;
         }
         if (innerException != null)
         {
             throw new HttpException(innerException.Message, innerException);
         }
     }
 }
コード例 #9
0
 internal CallHandlerExecutionStep(NetHttpApplication app)
 {
     _application        = app;
     _completionCallback = new AsyncCallback(OnAsyncHandlerCompletion);
 }
コード例 #10
0
            internal void AddHandler(object eventId, BeginEventHandler beginHandler, EndEventHandler endHandler, object state, RequestNotification requestNotification, bool isPost, NetHttpApplication app)
            {
                if (_table == null)
                {
                    _table = new Hashtable();
                }
                var handler = (AsyncAppEventHandler)_table[eventId];

                if (handler == null)
                {
                    handler         = new AsyncAppEventHandler();
                    _table[eventId] = handler;
                }
                handler.Add(beginHandler, endHandler, state);
                //if (HttpRuntime.UseIntegratedPipeline)
                //{
                //    var step = new AsyncEventExecutionStep(app, beginHandler, endHandler, state);
                //    app.AddEventMapping(app.CurrentModuleCollectionKey, requestNotification, isPost, step);
                //}
            }
コード例 #11
0
 internal MapHandlerExecutionStep(NetHttpApplication app)
 {
     _application = app;
 }
コード例 #12
0
 public ApplicationNetStepManager(NetHttpApplication application)
     : base(application)
 {
 }
コード例 #13
0
 internal NetAspNetSynchronizationContext(NetHttpApplication application)
 {
     _application = application;
 }
コード例 #14
0
        internal static void ProcessRequestNow(WebHost host, WebHostWorkerRequest wr, NetHttpApplicationFactory applicationFactory)
        {
            wr.ResetStartTime();
            NetHttpContext context;

            try { context = new NetHttpContext(wr); }
            catch
            {
                wr.SendStatus(400, "Bad Request");
                wr.SendKnownResponseHeader(12, "text/html; charset=utf-8");
                var bytes = Encoding.ASCII.GetBytes("<html><body>Bad Request</body></html>");
                wr.SendResponseFromMemory(bytes, bytes.Length);
                wr.FlushResponse(true);
                wr.EndOfRequest();
                return;
            }
            Console.WriteLine("a:Request");
            wr.SetEndOfSendNotification(_asyncEndOfSendCallback, context);
            Interlocked.Increment(ref host._activeRequests);
            NetHttpApplication application = null;

            try
            {
                try { EnsureFirstRequestInit(context); }
                catch
                {
                    if (!((NetHttpRequest)context.Request).IsDebuggingRequest)
                    {
                        throw;
                    }
                }
                ((NetHttpResponse)context.Response).InitResponseWriter();
                application = applicationFactory.GetApplicationInstance(wr, context);
                if (application == null)
                {
                    throw new HttpException("Unable_create_app_object");
                }
                if (application is INetHttpAsyncHandler)
                {
                    var handler2 = (INetHttpAsyncHandler)application;
                    context.AsyncAppHandler = handler2;
                    handler2.BeginProcessRequest(context, _handlerCompletionCallback, context);
                }
                else
                {
                    ((INetHttpHandler)application).ProcessRequest(context);
                    FinishRequest(host, context.WorkerRequest, context, null);
                }
            }
            catch (Exception ex)
            {
                ((NetHttpResponse)context.Response).InitResponseWriter();
                FinishRequest(host, wr, context, ex);
            }
            finally
            {
                if (application != null)
                {
                    applicationFactory.RecycleApplicationInstance(application);
                }
            }
        }
コード例 #15
0
 internal CallFilterExecutionStep(NetHttpApplication app)
 {
     _application = app;
 }
コード例 #16
0
 internal SyncEventExecutionStep(NetHttpApplication app, EventHandler handler)
 {
     _application = app;
     _handler     = handler;
 }
コード例 #17
0
 internal NetStepManager(NetHttpApplication app)
 {
     _application = app;
 }