当前位置: 首页>>代码示例>>C#>>正文


C# HttpWorkerRequest.SetEndOfSendNotification方法代码示例

本文整理汇总了C#中System.Web.HttpWorkerRequest.SetEndOfSendNotification方法的典型用法代码示例。如果您正苦于以下问题:C# HttpWorkerRequest.SetEndOfSendNotification方法的具体用法?C# HttpWorkerRequest.SetEndOfSendNotification怎么用?C# HttpWorkerRequest.SetEndOfSendNotification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.HttpWorkerRequest的用法示例。


在下文中一共展示了HttpWorkerRequest.SetEndOfSendNotification方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InternalExecuteRequest

		internal void InternalExecuteRequest (HttpWorkerRequest request)
		{
			IHttpHandler handler;
			IHttpAsyncHandler async_handler;

			HttpContext context = new HttpContext(request);

			request.SetEndOfSendNotification(_endOfSendCallback, context);
			
			Interlocked.Increment(ref _activeRequests);

			try {
				if (!_firstRequestStarted) {
					lock (this) {
						if (!_firstRequestStarted) {
							OnFirstRequestStart(context);
							_firstRequestStarted = true;
						}
					}
				}

				// This *must* be done after the configuration is initialized.
				context.Response.InitializeWriter ();
				handler = HttpApplicationFactory.GetInstance(context);
				if (null == handler)
					throw new HttpException(FormatResourceString("unable_to_create_app"));

				if (handler is IHttpAsyncHandler) {
					async_handler = (IHttpAsyncHandler) handler;

					context.AsyncHandler = async_handler;
					async_handler.BeginProcessRequest(context, _handlerCallback, context);
				} else {
					handler.ProcessRequest(context);
					FinishRequest(context, null);
				}
			}
			catch (Exception error) {
				context.Response.InitializeWriter ();
				FinishRequest(context, error);
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:42,代码来源:HttpRuntime.cs

示例2: RejectRequestInternal

 private void RejectRequestInternal(HttpWorkerRequest wr, bool silent)
 {
   HttpContext context = new HttpContext(wr, false);
   wr.SetEndOfSendNotification(this._asyncEndOfSendCallback, (object) context);
   Interlocked.Increment(ref this._activeRequestCount);
   HostingEnvironment.IncrementBusyCount();
   if (silent)
   {
     context.Response.InitResponseWriter();
     this.FinishRequest(wr, context, (Exception) null);
   }
   else
   {
     PerfCounters.IncrementGlobalCounter(GlobalPerfCounter.REQUESTS_REJECTED);
     PerfCounters.IncrementCounter(AppPerfCounter.APP_REQUESTS_REJECTED);
     try
     {
       throw new HttpException(503, System.Web.SR.GetString("Server_too_busy"));
     }
     catch (Exception ex)
     {
       context.Response.InitResponseWriter();
       this.FinishRequest(wr, context, ex);
     }
   }
 }
开发者ID:consumentor,项目名称:Server,代码行数:26,代码来源:HttpRuntime.cs

示例3: Process

		static void Process (HttpWorkerRequest req)
		{
			bool error = false;
			if (firstRun) {
				firstRun = false;
				if (initialException != null) {
					FinishWithException (req, HttpException.NewWithCode ("Initial exception", initialException, WebEventCodes.RuntimeErrorRequestAbort));
					error = true;
				}
				SetupOfflineWatch ();
			}
			HttpContext context = new HttpContext (req);
			HttpContext.Current = context;
			if (AppIsOffline (context))
				return;
			
			//
			// Get application instance (create or reuse an instance of the correct class)
			//
			HttpApplication app = null;
			if (!error) {
				try {
					app = HttpApplicationFactory.GetApplication (context);
				} catch (Exception e) {
					FinishWithException (req, HttpException.NewWithCode (String.Empty, e, WebEventCodes.RuntimeErrorRequestAbort));
					error = true;
				}
			}
			
			if (error) {
				context.Request.ReleaseResources ();
				context.Response.ReleaseResources ();
				HttpContext.Current = null;
			} else {
				context.ApplicationInstance = app;
				req.SetEndOfSendNotification (end_of_send_cb, context);

				//
				// Ask application to service the request
				//
				
				IHttpHandler ihh = app;
//				IAsyncResult appiar = ihah.BeginProcessRequest (context, new AsyncCallback (request_processed), context);
//				ihah.EndProcessRequest (appiar);
				ihh.ProcessRequest (context);

				HttpApplicationFactory.Recycle (app);
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:49,代码来源:HttpRuntime.cs

示例4: ProcessRequestInternal

 private void ProcessRequestInternal(HttpWorkerRequest wr)
 {
   Interlocked.Increment(ref this._activeRequestCount);
   if (this._disposingHttpRuntime)
   {
     try
     {
       wr.SendStatus(503, "Server Too Busy");
       wr.SendKnownResponseHeader(12, "text/html; charset=utf-8");
       byte[] bytes = Encoding.ASCII.GetBytes("<html><body>Server Too Busy</body></html>");
       wr.SendResponseFromMemory(bytes, bytes.Length);
       wr.FlushResponse(true);
       wr.EndOfRequest();
     }
     finally
     {
       Interlocked.Decrement(ref this._activeRequestCount);
     }
   }
   else
   {
     HttpContext context;
     try
     {
       context = new HttpContext(wr, false);
     }
     catch
     {
       try
       {
         wr.SendStatus(400, "Bad Request");
         wr.SendKnownResponseHeader(12, "text/html; charset=utf-8");
         byte[] bytes = Encoding.ASCII.GetBytes("<html><body>Bad Request</body></html>");
         wr.SendResponseFromMemory(bytes, bytes.Length);
         wr.FlushResponse(true);
         wr.EndOfRequest();
         return;
       }
       finally
       {
         Interlocked.Decrement(ref this._activeRequestCount);
       }
     }
     wr.SetEndOfSendNotification(this._asyncEndOfSendCallback, (object) context);
     HostingEnvironment.IncrementBusyCount();
     try
     {
       try
       {
         this.EnsureFirstRequestInit(context);
       }
       catch
       {
         if (!context.Request.IsDebuggingRequest)
           throw;
       }
       context.Response.InitResponseWriter();
       IHttpHandler applicationInstance = HttpApplicationFactory.GetApplicationInstance(context);
       if (applicationInstance == null)
         throw new HttpException(System.Web.SR.GetString("Unable_create_app_object"));
       if (EtwTrace.IsTraceEnabled(5, 1))
         EtwTrace.Trace(EtwTraceType.ETW_TYPE_START_HANDLER, context.WorkerRequest, applicationInstance.GetType().FullName, "Start");
       if (applicationInstance is IHttpAsyncHandler)
       {
         IHttpAsyncHandler httpAsyncHandler = (IHttpAsyncHandler) applicationInstance;
         context.AsyncAppHandler = httpAsyncHandler;
         httpAsyncHandler.BeginProcessRequest(context, this._handlerCompletionCallback, (object) context);
       }
       else
       {
         applicationInstance.ProcessRequest(context);
         this.FinishRequest(context.WorkerRequest, context, (Exception) null);
       }
     }
     catch (Exception ex)
     {
       context.Response.InitResponseWriter();
       this.FinishRequest(wr, context, ex);
     }
   }
 }
开发者ID:consumentor,项目名称:Server,代码行数:81,代码来源:HttpRuntime.cs


注:本文中的System.Web.HttpWorkerRequest.SetEndOfSendNotification方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。