【问题标题】:ASP.NET-4 IIS7.5 web.config serverRuntime elementASP.NET-4 IIS7.5 web.config serverRuntime 元素
【发布时间】:2010-08-28 11:33:59
【问题描述】:

每当我在 system.webServer 部分的 web.config 中添加这一行时:

<serverRuntime />

由于我们没有属性,IIS 7.5 只是提供一个空白页面而不是网站。我使用 IIS 创建了一个新的空 Web 应用程序并将该行添加到 web.config;空白页。

我做错了什么?

【问题讨论】:

  • 要说你做错了什么,你首先需要说你想做什么。为什么需要这个?
  • 我需要将frequentHitThreshold设置为1来为CSS启用gzip压缩。

标签: web-config asp.net-4.0 iis-7.5


【解决方案1】:

我遇到了这个确切的问题,并通过解锁 applicationHost 配置的 serverRuntime 部分来解决它。在控制台运行的命令:

%windir%\system32\inetsrv\appcmd unlock config -section:system.webServer/serverRuntime

【讨论】:

    【解决方案2】:

    所以您实际上是在将它添加到您的网络配置中?

    <location path="Default Web Site">
       <system.webServer>
          <serverRuntime enabled="true"
             frequentHitThreshold="1"
             frequentHitTimePeriod="00:00:20" />
       </system.webServer>
    </location>
    

    有几件重要的事情需要牢记...

    1. 您在集成模式下运行 IIS7,而不是经典模式。
    2. 您在 serverRuntime 上设置了 enabled="true" 属性

    MSDN 上的进一步阅读

    http://msdn.microsoft.com/en-us/library/aa347568%28VS.90%29.aspx

    【讨论】:

    • 其实,Haney 的回答可能更贴切。至少在我尝试过的服务器上,只需将 serverRuntime 元素添加到 web.config 将在命中与相​​应位置规范匹配的任何路径时导致错误。或者,可以直接在 appSettings.config 中进行配置,如iis.net/configreference/system.webserver/serverruntime 中所述(这就是我所做的),或者可以推测,按照 Haney 的建议解锁元素将可以在 web.config 中进行配置。
    猜你喜欢
    • 1970-01-01
    • 2010-12-20
    • 1970-01-01
    • 2011-07-07
    • 1970-01-01
    • 2015-01-07
    • 2010-11-25
    • 2011-05-26
    • 1970-01-01
    相关资源
    最近更新 更多