IIS7 Application Request Routing (arr reverse proxy) combined with managed module - time out

前端 未结 4 635
遥遥无期
遥遥无期 2021-02-04 10:55

I am trying to build a proxy that would serve requests to an internal site (hiding the origin) but at the same time inspect the packets and asynchronously post-process them.

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-04 11:21

    If you can switch to .Net Framework 4, there is a solution for this.

    After you are done with your BeginRequest/EndRequest in your HttpModule event handler, add a call to HttpRequest.InsertEntityBody.

        /* BeginRequest event: Executes before request is processed */
        private void Application_BeginRequest(Object source, EventArgs e)
        {
            HttpApplication application = (HttpApplication)source;
            HttpRequest request = application.Context.Request;
    
            // Do something with request
            DoMyOwnRequestProcessing(request);
    
            // After you finish, make sure IIS gets the entity body
            // For example, Application Request Routing needs this
            request.InsertEntityBody();
        }
    

    Take a look at this on MSDN: HttpRequest.InsertEntityBody.

提交回复
热议问题