将dotless添加到我的本地网站后,HTTP错误500.23

时间:2013-07-23 10:02:03

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

您好我正在尝试在我当地的.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.

你能帮忙吗?

4 个答案:

答案 0 :(得分:28)

添加<validation validateIntegratedModeConfiguration="false"/>工作

<?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 :(得分:11)

<validation validateIntegratedModeConfiguration="false"/> tells IIS to ignore configuration issues。其中一个问题似乎是无点自动为system.websystem.webServer添加处理程序。前一部分由经典应用程序池模式使用,而后者由新的集成应用程序池模式使用。由于我使用的是集成模式,因此删除system.web中的处理程序也是有帮助的。

答案 2 :(得分:0)

我必须将<validation validateIntegratedModeConfiguration="false"/>添加到我的网络服务器部分,我还必须将configSections移动到我的配置中的第一个元素。

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

答案 3 :(得分:0)

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

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