• 检测到在集成的托管管道模式下不适用的ASP.NET设置的解决方法(转载)


    我们将ASP.NET程序从IIS6移植到IIS7,可能运行提示以下错误:

    HTTP 错误 500.23 - Internal Server Error

    检测到在集成的托管管道模式下不适用的 ASP.NET 设置。

    为什么会出现以上错误?

    在IIS7的应用程序池有两种模式,一种是“集成模式”,一种是“经典模式”。

    经典模式 则是我们以前习惯的IIS 6 的方式。

    如果使用集成模式,那么对自定义的httpModules和httpHandlers 就要修改web.config配置文件,需要将他们转移到<modules>和<hanlders>节点里去。否者集成模式会认为你将自定义的httpModules和httpHandlers错误地放在了经典模式的<system.Web>节点下了,就会像上面这样报错提醒。当然后我们也可以通过web.config中的validateIntegratedModeConfiguration选项来关闭集成模式检查,避免这个报错,本文后面会讲这个设置。

     

    第一种方法、配置应用程序池

    在IIS7上配置应用程序池,并且将程序池的模式改为“经典”,之后一切正常。如图:

    在搜索引擎输入上面提示的错误消息,搜索到的结果几乎都是直接改为“经典”便浅尝辄止了。

    但这样只是权宜之计,用了IIS7.x,但实际只发挥了6的功能,另外,在一些ASP.NET MVC程序中的效果也不好,所以,我们尝试以下解决方法:

    第二种方法、修改web.config配置文件:

    例如原先设置(你的环境中可能没有httpModules,httpHandlers节点)

    <system.web>
    
        ............
    
        <httpModules>
            <add name="MyModule" type="MyApp.MyModule" />
        </httpModules>
        <httpHandlers>
          <add path="*.myh" verb="GET" type="MyApp.MyHandler" />
        </httpHandlers>
    
    
    </system.web>

    在IIS7应用程序池为“集成模式”时,改为:

    <system.web>
    
        ...........
    
    </system.web>
    
    <system.webServer>
    
        <modules>
          <add name="MyModule" type="MyApp.MyModule" />      
        </modules>
        <handlers>
          <add name="MyHandler" path="*.myh" verb="GET" type="MyApp.MyHandler" preCondition="integratedMode" />
        </handlers>
    
    </system.webServer>

    当然你也可以同时在<system.Web>和<system.webServer>中注册你的httpModules和httpHandler来兼容IIS6和IIS7的设置,如下所示:

    <system.web>
    
        <httpModules>
            <add name="MyModule" type="MyApp.MyModule" />
        </httpModules>
        <httpHandlers>
          <add path="*.myh" verb="GET" type="MyApp.MyHandler" />
        </httpHandlers>
    </system.web>
    
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
    
        <modules>
          <add name="MyModule" type="MyApp.MyModule" />      
        </modules>
        <handlers>
          <add name="MyHandler" path="*.myh" verb="GET" type="MyApp.MyHandler" preCondition="integratedMode" />
        </handlers>
    
    </system.webServer>

    但是注意这样的话要将<system.webServer>下的validateIntegratedModeConfiguration选项设置为false,告诉IIS 7不要去检查<system.Web>下的<httpModules>和<httpHandlers>节点,来避免错误。

    原文链接

  • 相关阅读:
    react_瞎敲
    linux 删除类似文件
    mysql建立dblink 视图,无法查询到数据的问题
    Guava-Retrying 请求重试机制
    Command line is too long. Shorten command line for WebServiceUtilsTest.callMethod or also for JUnit default
    @Scheduled 定时任务注解不能运行
    jq拷贝表单$("#searchForm").clone(true),无法将select2数据value拷贝的问题
    正则表达式的lookaround(lookahead/lookbehind)以及密码复杂度检查
    MYSQL列的长度,NUMERIC_PRECISION和COLUMN_TYPE
    Qira-docker安装与使用
  • 原文地址:https://www.cnblogs.com/OpenCoder/p/9072266.html
Copyright © 2020-2023  润新知