VS2010 development web server does not use integrated-mode HTTP handlers/modules

穿精又带淫゛_ 提交于 2019-11-30 08:13:57
Sky Sanders

You don't. WebDev.WebServer.exe does not and cannot support integrated pipeline.

So, if you have code that cannot be written to perform in both environments you will need to use a local IIS for development.

Basically, system.web is the place to configure webdev server and IIS5-6 handlers and modules. system.webServer is for IIS7 handlers and modules, as you know.

Reference:

Each request in WebDev.WebHost40 (and previous versions) is processed by HttpRuntime.ProcessRequest (which does not support integrated pipeline mode). This is the method used in all three versions of WebHost.WebServer.dll (the core of WebDev.WebServer.exe)

And the word of some dude who is fairly familiar with the inner workings of Cassini/WebDev by virtue of managing this project. ;-)

I'm not sure if I'm too late in answering, but while it's known fact that the Cassini server doesn't support integrated pipeline mode, you can still test locally using the classic pipeline by adding it to the httpModules section of system.web in your web.config:

  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    .
    .
    .
    <!-- HTTP Modules using Classic Pipeline -->
    <httpModules>
      <add name="YourHttpModule" type="ACME.YourHttpModule"/>
    </httpModules>
  </system.web>

  <system.webServer>
    <!-- HTTP Modules using Integrated Pipeline -->
    <modules runAllManagedModulesForAllRequests="true">
      <add name="YourHttpModule" type="ACME.YourHttpModule"/>
    </modules>
  </system.webServer>

You'd probably want to remove the httpModules section from your production web.config.

Got this today while running in visual studio 2012. Found the reason was visual studio launched the old web server that comes with 2010 and as explained above it can't work there. Changed to IIS Express by right click on properties, choose "Web" tab and and selecting IIS Express option. Then launching debug mode will start in IIS Express and this aparently supports operations such as Request.Headers.Add or whatever caused your exception.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!