欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

IIS6服务器的请求流程(图文&源码)

程序员文章站 2022-08-09 20:58:57
1.IIS 7开发与管理完全参考手册 http://book.51cto.com/art/200908/146040.htm 2.Web服务IIS 6 https://technet.microsoft.com/zh-cn/library/2005.05.servingtheweb(en-us).a ......
1.IIS 7开发与管理完全参考手册  http://book.51cto.com/art/200908/146040.htm 2.Web服务IIS 6   https://technet.microsoft.com/zh-cn/library/2005.05.servingtheweb(en-us).aspx 3.《简单流程图》

IIS6服务器的请求流程(图文&源码)

 

 

 

 

 

IIS6服务器的请求流程(图文&源码)

 4.这个就是处理 【托管程序】的入口方法了  
 1 [SecurityPermission(SecurityAction.LinkDemand, Unrestricted=true)]
 2 public int ProcessRequest(IntPtr ecb, int iWRType){
 3     IntPtr zero = IntPtr.Zero;
 4     if ( iWRType == 2 ){zero = ecb;ecb = UnsafeNativeMethods.GetEcb(zero);}
 5     ISAPIWorkerRequest wr = null; //ISAPIWorkerRequest : HttpWorkerRequest
 6     try{
 7         bool useOOP = iWRType == 1;
 8         wr = ISAPIWorkerRequest.CreateWorkerRequest(ecb, useOOP);//将 ecb 句柄封装成 HttpWorkerRequest 的 源码在此 !!!
 9         wr.Initialize();
10         string appPathTranslated = wr.GetAppPathTranslated();
11         string appDomainAppPathInternal = HttpRuntime.AppDomainAppPathInternal;
12 
13         if ((appDomainAppPathInternal == null) || StringUtil.EqualsIgnoreCase(appPathTranslated, appDomainAppPathInternal))
14         {
15             HttpRuntime.ProcessRequestNoDemand(wr);
16             return 0;
17         }
18 
19         object[] args = new object[] { appDomainAppPathInternal, appPathTranslated };
20         HttpRuntime.ShutdownAppDomain(ApplicationShutdownReason.PhysicalApplicationPathChanged, SR.GetString("Hosting_Phys_Path_Changed", args));
21         return 1;
22     }catch (Exception exception){
23         try{ WebBaseEvent.RaiseRuntimeError(exception, this); }catch{}
24         if ( (wr == null) || !(wr.Ecb == IntPtr.Zero) ){throw;}
25         if ( zero != IntPtr.Zero ){UnsafeNativeMethods.SetDoneWithSessionCalled(zero);}
26         if ( exception is ThreadAbortException ){Thread.ResetAbort();}
27         return 0;
28     }
29 }
5.aspx页面的执行过程,可以在页面加入<%@ Page Language="C#"  Trace="true" %> aspx页面执行流程会在浏览器中显示

IIS6服务器的请求流程(图文&源码)