cixiren 发表于 2015-11-15 09:05:21

IIS服务器代替VS自带的服务器

http://blog.iyunv.com/kyleing/article/details/

我们将ASP.NET程序从IIS6移植到IIS7,可能运行提示以下错误:
HTTP 错误 500.23 - Internal Server Error
检测到在集成的托管管道模式下不适用的 ASP.NET设置。
  为什么会出现以上错误?
  在IIS7的应用程序池有两种模式,一种是“集成模式”,一种是“经典模式”。
  经典模式 则是我们以前习惯的IIS 6 的方式。
  如果使用集成模式,那么对自定义的httpModules 和 httpHandlers 就要修改配置文件,需要将他们转移到<modules>和<hanlders>节里去。
  两种解决方法:
  第一种方法、配置应用程序池
  在IIS7上配置应用程序池,并且将程序池的模式改为“经典”,之后一切正常。如图:
http://blog.iyunv.com/kyleing/article/details/


  第二种方法、修改web.config配置文件
  例如原先设置
<system.web>

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

   <httpModules>
      <addname=&quot;MyModule&quot; type=&quot;MyApp.MyModule&quot; />
   </httpModules>
   <httpHandlers>
      <addpath=&quot;*.myh&quot; verb=&quot;GET&quot; type=&quot;MyApp.MyHandler&quot;/>
   </httpHandlers>
</system.web>
  在IIS7应用程序池为“集成模式”时,改为
<system.web>

    ...........

</system.web>

<system.webServer>
    <modules>
      <addname=&quot;MyModule&quot; type=&quot;MyApp.MyModule&quot; />      
   </modules>
   <handlers>
      <addname=&quot;MyHandler&quot; path=&quot;*.myh&quot; verb=&quot;GET&quot;type=&quot;MyApp.MyHandler&quot; preCondition=&quot;integratedMode&quot; />
   </handlers>
    <validationvalidateIntegratedModeConfiguration=&quot;false&quot; />
</system.webServer>
如果想保留原先设置,更改后可以设置禁止验证集成模式(validateIntegrateModeConfiguration=&quot;false&quot;),是不会产生错误的。


以前收集的,出处未明,望原作见谅!
  
页: [1]
查看完整版本: IIS服务器代替VS自带的服务器