加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net删除未使用的httpmodules

发布时间:2020-12-16 07:07:17 所属栏目:asp.Net 来源:网络整理
导读:我正在查看有关asp.net的大量页面的性能建议.具体来说,删除未使用的httpmodules部分: httpModules add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/ add name="Session" type="System.Web.SessionState.SessionStateModule"/ add name
我正在查看有关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,PublicKeyToken=b77a5c561934e089"/>
</httpModules>

这里列出了大量的HTTP模块,我非常肯定,并非所有这些都被您的应用程序使用.删除未使用的HTTP模块肯定会带来轻微的性能提升,因为执行的工作量会减少.假设在应用程序中不需要Windows身份验证.要删除继承的设置,请在web.config应用程序的httpModules部分下添加一个remove元素,并指定不需要的模块的名称.
例:

<httpModules>
        <remove name="WindowsAuthentication" />
  </httpModules>

有没有人知道哪里有各自的描述,有些是显而易见但不是全部,我已经在谷歌上已经有一段时间了.

解决方法

通过Mads Kristensen的博客,来自ScottGu的评论.

http://madskristensen.net.web7.reliabledomainspace.com/post/Remove-default-HTTP-modules-in-ASPNET.aspx

In general you can get some very small performance wins using this approach – although I’d probably recommend not doing it. The reason is that some features of ASP.NET (forms auth,roles,caching,etc) will of course stop working once you remove the modules they depend on. Trying to figure out why this has happened can often be confusing.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读