上面兩篇文章說(shuō)了http協(xié)議和IIS處理,這次說(shuō)下當(dāng)IIS把請(qǐng)求交給Asp.net后的過(guò)程。
AppManagerAppDomainFactory
當(dāng)IIS把請(qǐng)求交給asp.net時(shí)候,如果AppDomain還不存在則創(chuàng)建APPDomain,將AppDomain指派給與請(qǐng)求對(duì)應(yīng)的應(yīng)用程序,這通過(guò)AppManagerAppDomainFactory類中的Create方法實(shí)現(xiàn),代碼如下:
public Object Create(String appId, String appPath) { try { if (appPath[0] == '.') { System.IO.FileInfo file = new System.IO.FileInfo(appPath); appPath = file.FullName; } if (!StringUtil.StringEndsWith(appPath, '\\')) { appPath = appPath + "\\"; } ... ISAPIApplicationHost appHost = new ISAPIApplicationHost(appId, appPath,false); //創(chuàng)建環(huán)境,包括編譯環(huán)境 ISAPIRuntime isapiRuntime = (ISAPIRuntime)_appManager.CreateObjectInternal(appId, typeof(ISAPIRuntime), appHost, false, null); isapiRuntime.StartProcessing(); return new ObjectHandle(isapiRuntime); } catch (Exception e) { &n