自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

淺談ASP.NET管道優(yōu)化

開發(fā) 后端
本文介紹ASP.NET管道優(yōu)化,位于請求管道中的很多ASP.NET默認(rèn)的HttpModules用于攔截客戶端所發(fā)出的每個請求。

ASP.NET管道優(yōu)化

位于請求管道中的很多ASP.NET默認(rèn)的HttpModules用于攔截客戶端所發(fā)出的每個請求。例如,SessionStateModule攔截每個請求,并解析對應(yīng)的會話cookie,然后在HttpContext中加載適當(dāng)?shù)臅?。實時證明,并不是所有的modules都是必要的。

例如,如果你不使用Membership和Profile provider提供程序,那么你就可以不需要FormsAuthentication module。如果你需要為你的用戶使用Windows驗證,那么你就可以不需要WindowsAuthentication。位于管道中的這些 modules僅僅在每次請求到來時執(zhí)行一些不必要的代碼。

默認(rèn)的modules都定義在了machine.config文件中(位于$WINDOWS$\Microsoft.NET\Framework\$VERSION$\CONFIG目錄下)。

  1. <httpModules> 
  2. <add name="OutputCache" type="System.Web.Caching.OutputCacheModule" /> 
  3. <add name="Session" type="System.Web.SessionState.SessionStateModule" /> 
  4. <add name="WindowsAuthentication" 
  5. type="System.Web.Security.WindowsAuthenticationModule" /> 
  6. <add name="FormsAuthentication" 
  7. type="System.Web.Security.FormsAuthenticationModule" /> 
  8. <add name="PassportAuthentication" 
  9. type="System.Web.Security.PassportAuthenticationModule" /> 
  10. <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" /> 
  11. <add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" /> 
  12. <add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule,  
  13. System.Web.Mobile, Version=1.0.5000.0,  
  14. Culture=neutralPublicKeyToken=b03f5f7f11d50a3a/> 
  15. </httpModules> 

你可以通過在站點的web.config文件中添加<remove>節(jié)點到你的網(wǎng)站應(yīng)用程序中來刪除這些默認(rèn)的modules。ASP.NET管道優(yōu)化代碼例如:

 

  1. <httpModules> 
  2.  <!-- Remove unnecessary Http Modules for faster pipeline --> 
  3.  <remove name="Session" /> 
  4.  <remove name="WindowsAuthentication" /> 
  5.  <remove name="PassportAuthentication" /> 
  6.  <remove name="AnonymousIdentification" /> 
  7.  <remove name="UrlAuthorization" /> 
  8.  <remove name="FileAuthorization" /> 
  9. </httpModules> 


上面的配置對于使用了數(shù)據(jù)庫并基于Forms驗證的網(wǎng)站來說非常適合,它們并不需要任何會話的支持。因此,所有這些modules都可以安全的刪除。以上介紹ASP.NET管道優(yōu)化

【編輯推薦】

  1. 淺析ASP.NET中配置文件
  2. .NET RIA Services就像ASP.NET那樣方便
  3. ASP.NET AJAX Extensions中UpdatePanel控件概述
  4. ASP.NET調(diào)用UpdatePanel的Update()方法
  5. 淺談ASP.NET AJAX的WCF服務(wù)
責(zé)任編輯:佚名 來源: yuzi
相關(guān)推薦

2009-07-24 10:52:42

ASP.NET ISA

2009-07-22 16:11:43

ASP.NET AJA

2009-07-20 15:30:11

ASP.NET應(yīng)用

2009-02-23 15:55:29

ASP.NET.NET性能提升

2009-08-05 15:29:33

ASP.NET For

2009-07-23 15:44:39

ASP.NET MVC

2009-07-28 17:49:30

ASP.NET定期回收

2009-07-22 13:24:24

ASP.NET MVC

2009-07-28 16:03:23

ASP.NET狀態(tài)服務(wù)

2009-08-10 10:19:47

ASP.NET組件設(shè)計

2009-07-20 17:12:17

ASP.NET訪問數(shù)據(jù)

2009-07-23 15:24:37

ASP.NET Ima

2011-08-23 10:58:59

2009-07-27 16:19:59

ASP.NET報表控件

2009-07-28 17:34:28

ASP.NET XML

2009-07-28 18:00:11

ASP.NET程序

2009-07-21 15:02:19

ASP.NET應(yīng)用程序

2009-07-22 17:21:27

ASP.NET 2.0

2009-07-29 09:38:06

Web開發(fā)ASP.NET

2009-07-27 13:01:28

TreeViewASP.NET
點贊
收藏

51CTO技術(shù)棧公眾號