【问题标题】:asp.net remove unused httpmodulesasp.net 删除未使用的 httpmodules
【发布时间】:2008-11-18 01:48:13
【问题描述】:

我正在查看许多页面关于 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>

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

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

有没有人知道在哪里有每个功能的描述,有些很明显但不是全部,我在谷歌上搜索了很长时间。

【问题讨论】:

    标签: asp.net performance


    【解决方案1】:

    来自 ScottGu 的评论,来自 Mads Kristensen 的博客。

    https://www.madskristensen.net/blog/remove-default-http-modules-in-aspnet/

    一般来说你可以得到一些非常小的 使用这种方法赢得性能 - 虽然我可能不建议 正在做。原因是有些 ASP.NET 的功能(表单身份验证, 角色,缓存等)当然会 删除后停止工作 他们依赖的模块。尝试去 弄清楚为什么会这样 经常令人困惑。

    【讨论】:

    • 我冒昧地修复了 asnwer 中损坏的链接
    猜你喜欢
    • 1970-01-01
    • 2010-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-27
    • 1970-01-01
    • 2014-10-21
    • 1970-01-01
    相关资源
    最近更新 更多