【问题标题】:HTTP Error 500.23 after adding dotless to my local website将 dotless 添加到我的本地网站后出现 HTTP 错误 500.23
【发布时间】:2013-07-22 08:07:04
【问题描述】:

您好,我正在尝试在我的本地 .net4 网站上运行 dotless

我的网络配置如下所示:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
  </configSections>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  <httpHandlers><add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" /></httpHandlers></system.web>
<dotless minifyCss="false" cache="true" web="false" />

    <system.webServer>
        <handlers>
            <add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
        </handlers>
    </system.webServer>
</configuration>

这是我得到的错误

HTTP Error 500.23 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
Most likely causes:

    This application defines configuration in the system.web/httpHandlers section.

你能帮忙吗?

【问题讨论】:

    标签: asp.net .net web-config dotless


    【解决方案1】:

    我们将在 web.config 文件中添加一小段代码。从 IIS 根目录打开 web.config 或更改 Visual Studio web.config 中的设置并再次发布。

      <system.webServer>
                <validation validateIntegratedModeConfiguration="false"/>
              </system.webServer>
    

    【讨论】:

    • 这是先前答案的副本
    【解决方案2】:

    我必须将&lt;validation validateIntegratedModeConfiguration="false"/&gt; 添加到我的网络服务器部分,并且我还必须将 configSections 移动为我的配置中的第一个元素。

    <configuration>
    <configSections>
    <section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
    

    【讨论】:

      【解决方案3】:

      &lt;validation validateIntegratedModeConfiguration="false"/&gt;tells IIS to ignore configuration issues。一个这样的问题似乎是 dotless 自动将处理程序添加到 system.websystem.webServer。前段为经典应用池模式,后段为新的集成应用池模式。由于我使用的是集成模式,因此删除 system.web 中的处理程序也有帮助。

      【讨论】:

      • 谢谢!。我刚刚从 system.web 部分中删除了 httpHandler 部分,一切正常。
      • 这应该是答案,因为它实际上解决了根本问题,而不是贴上创可贴。
      【解决方案4】:

      添加&lt;validation validateIntegratedModeConfiguration="false"/&gt; 工作

      <?xml version="1.0" encoding="utf-8"?>
      <configuration>
        <configSections>
          <section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
        </configSections>
        <system.web>
          <compilation debug="true" targetFramework="4.0" />
        <httpHandlers>
            <add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />
        </httpHandlers>
        </system.web>
      <dotless minifyCss="false" cache="true" web="false" />
      
          <system.webServer>
              <validation validateIntegratedModeConfiguration="false"/>
              <handlers>
                  <add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
              </handlers>
          </system.webServer>
      </configuration>
      

      【讨论】:

      • 这解决了我需要运行的一个古老项目的问题!谢谢+1。
      猜你喜欢
      • 1970-01-01
      • 2014-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-05
      • 1970-01-01
      • 1970-01-01
      • 2021-02-25
      相关资源
      最近更新 更多