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

在一个项目中,从vs2010切换到2015时候出现了:

HTTP 错误 500.23 - Internal Server Error

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


错误原因如下:

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

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

如果使用集成模式,那么对自定义的httpModules 和 httpHandlers 就要修改配置文件,需要将他们转移到<modules>和<hanlders>节里去。

两种解决方法:

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

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


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

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

<span class="tag" style="color: rgb(0, 0, 128);"><<span class="title">system.web</span>></span>

    ............

    <span class="tag" style="color: rgb(0, 0, 128);"><<span class="title">httpModules</span>></span>
        <span class="tag" style="color: rgb(0, 0, 128);"><<span class="title">add</span> <span class="attribute" style="color: rgb(0, 128, 128);">name</span>=<span class="value" style="color: rgb(221, 17, 68);">"MyModule"</span> <span class="attribute" style="color: rgb(0, 128, 128);">type</span>=<span class="value" style="color: rgb(221, 17, 68);">"MyApp.MyModule"</span> /></span>
    <span class="tag" style="color: rgb(0, 0, 128);"></<span class="title">httpModules</span>></span>
    <span class="tag" style="color: rgb(0, 0, 128);"><<span class="title">httpHandlers</span>></span>
      <span class="tag" style="color: rgb(0, 0, 128);"><<span class="title">add</span> <span class="attribute" style="color: rgb(0, 128, 128);">path</span>=<span class="value" style="color: rgb(221, 17, 68);">"*.myh"</span> <span class="attribute" style="color: rgb(0, 128, 128);">verb</span>=<span class="value" style="color: rgb(221, 17, 68);">"GET"</span> <span class="attribute" style="color: rgb(0, 128, 128);">type</span>=<span class="value" style="color: rgb(221, 17, 68);">"MyApp.MyHandler"</span> /></span>
    <span class="tag" style="color: rgb(0, 0, 128);"></<span class="title">httpHandlers</span>></span>


<span class="tag" style="color: rgb(0, 0, 128);"></<span class="title">system.web</span>></span>

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

<span class="tag" style="color: rgb(0, 0, 128);"><<span class="title">system.web</span>></span>

    ...........

<span class="tag" style="color: rgb(0, 0, 128);"></<span class="title">system.web</span>></span>

<span class="tag" style="color: rgb(0, 0, 128);"><<span class="title">system.webServer</span>></span>

    <span class="tag" style="color: rgb(0, 0, 128);"><<span class="title">modules</span>></span>
      <span class="tag" style="color: rgb(0, 0, 128);"><<span class="title">add</span> <span class="attribute" style="color: rgb(0, 128, 128);">name</span>=<span class="value" style="color: rgb(221, 17, 68);">"MyModule"</span> <span class="attribute" style="color: rgb(0, 128, 128);">type</span>=<span class="value" style="color: rgb(221, 17, 68);">"MyApp.MyModule"</span> /></span>      
    <span class="tag" style="color: rgb(0, 0, 128);"></<span class="title">modules</span>></span>
    <span class="tag" style="color: rgb(0, 0, 128);"><<span class="title">handlers</span>></span>
      <span class="tag" style="color: rgb(0, 0, 128);"><<span class="title">add</span> <span class="attribute" style="color: rgb(0, 128, 128);">name</span>=<span class="value" style="color: rgb(221, 17, 68);">"MyHandler"</span> <span class="attribute" style="color: rgb(0, 128, 128);">path</span>=<span class="value" style="color: rgb(221, 17, 68);">"*.myh"</span> <span class="attribute" style="color: rgb(0, 128, 128);">verb</span>=<span class="value" style="color: rgb(221, 17, 68);">"GET"</span> <span class="attribute" style="color: rgb(0, 128, 128);">type</span>=<span class="value" style="color: rgb(221, 17, 68);">"MyApp.MyHandler"</span> <span class="attribute" style="color: rgb(0, 128, 128);">preCondition</span>=<span class="value" style="color: rgb(221, 17, 68);">"integratedMode"</span> /></span>
    <span class="tag" style="color: rgb(0, 0, 128);"></<span class="title">handlers</span>></span>

<span class="tag" style="color: rgb(0, 0, 128);"></<span class="title">system.webServer</span>></span>

网上找了很多资料,一般都是说把资源池的托管管道模式改成经典模式,但是我这里还是不行

然后看到在配置文件中加上下面的节点就行了,解决问题!希望能帮大家早点解决问题

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





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值