Pet*_*teT 5 asp.net performance
我正在查看有关asp.net的大量页面的性能建议.具体来说,删除未使用的httpmodules部分:
<httpModules>
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
<add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule"/>
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule"/>
<add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule"/>
<add name="RoleManager" type="System.Web.Security.RoleManagerModule"/>
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule"/>
<add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule"/>
<add name="AnonymousIdentification" type="System.Web.Security.AnonymousIdentificationModule"/>
<add name="Profile" type="System.Web.Profile.ProfileModule"/>
<add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</httpModules>
Run Code Online (Sandbox Code Playgroud)
这里列出了大量的HTTP模块,我非常肯定,并非所有这些都被您的应用程序使用.删除未使用的HTTP模块肯定会带来轻微的性能提升,因为执行的工作量会减少.假设在应用程序中不需要Windows身份验证.要删除继承的设置,请在web.config应用程序的httpModules部分下添加一个remove元素,并指定不需要的模块的名称.例:
<httpModules>
<remove name="WindowsAuthentication" />
</httpModules>
Run Code Online (Sandbox Code Playgroud)
有没有人知道哪里有各自的描述,有些是显而易见但不是全部,我已经在谷歌上已经有一段时间了.
通过Mads Kristensen的博客,来自ScottGu的评论.
一般来说,使用这种方法可以获得一些非常小的性能胜利 - 尽管我可能建议不要这样做.原因是ASP.NET的某些功能(表单身份验证,角色,缓存等)当然会在您删除它们所依赖的模块后停止工作.试图找出发生这种情况的原因往往令人困惑.