27

嗨,我正在尝试在本地 .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

4 回答 4

29

添加 <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>
于 2013-07-23T12:12:50.147 回答
13

<validation validateIntegratedModeConfiguration="false"/> 告诉 IIS 忽略配置问题。一个这样的问题似乎是 dotless 自动将处理程序添加到system.weband system.webServer。前段为经典应用池模式,后段为新的集成应用池模式。由于我使用的是集成模式,因此删除 system.web 中的处理程序也有帮助。

于 2015-07-28T13:50:17.387 回答
0

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

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

于 2015-08-20T20:03:42.273 回答
-1

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

  <system.webServer>
            <validation validateIntegratedModeConfiguration="false"/>
          </system.webServer>
于 2018-05-30T07:09:11.490 回答