What’s the difference between <system.web> and <system.webServer>?

简介:

当你有自定义的HttpModule和HttpHandler时,需要同时在这两处添加

这个是为IIS6或者IIS7的经典模式用的

1
2
3
4
5
6
7
8
9
10
11
12
13
14
< system.web >
< httpHandlers >
       < remove  verb="*" path="*.asmx"/>
       < add  verb="*" path="CombineScriptHandler.aspx" validate="false" type="MvcScriptManager.CombineScriptHandler, MvcScriptManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6eb4f344e8972dc6"/>
       < add  verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       < add  verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       < add  verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
       < add  verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
     </ httpHandlers >
     < httpModules >
       < add  name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       < add  name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
     </ httpModules >
</ system.web >

这个是为IIS7的集成模式用的

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
< system.webServer >
     < validation  validateIntegratedModeConfiguration="false"/>
     < modules  runAllManagedModulesForAllRequests="true">
       < remove  name="ScriptModule"/>
       < remove  name="UrlRoutingModule"/>
       < add  name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       < add  name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
     </ modules >
     < handlers >
       < remove  name="WebServiceHandlerFactory-Integrated"/>
       < remove  name="ScriptHandlerFactory"/>
       < remove  name="ScriptHandlerFactoryAppServices"/>
       < remove  name="ScriptResource"/>
       < remove  name="MvcHttpHandler"/>
       < remove  name="UrlRoutingHandler"/>
       < add  name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       < add  name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       < add  name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       < add  name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       < add  name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </ handlers >
</ system.webServer >
本文转自敏捷的水博客园博客,原文链接http://www.cnblogs.com/cnblogsfans/archive/2009/09/25/1574129.html如需转载请自行联系原作者

王德水
相关文章
|
7月前
|
应用服务中间件 nginx
【报错】Failed to start A high performance web server and a reverse proxy server.
【报错】Failed to start A high performance web server and a reverse proxy server.
535 2
|
4月前
|
Shell PHP Windows
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
|
7月前
|
应用服务中间件
Web开发:关于Tomcat出现The origin server did not find a current representation for the target resourc...的问题
Web开发:关于Tomcat出现The origin server did not find a current representation for the target resourc...的问题
143 0
There is no configured/running web-servers found Please, run any web-configuration and hit the
There is no configured/running web-servers found Please, run any web-configuration and hit the
144 0
|
前端开发 .NET 开发框架
|
.NET 开发框架 前端开发
Web.config设置system.webServer
  一般情况在iis部署web网站都非常顺利,但是遇到复杂环境,或者被配置过又正在使用的时候,就束手无策了,   因为对IIS和Web.config不熟悉,不知其中要害,导致浪费一天甚至更久的时间去处理一个可能是不起眼的配置问题   本文主要和大家共同探讨下Web.config的system.webServer节点配置,如有错误之处,劳烦指点下   环境:IIS 7.0及以上 一、总览   system.WebServer 是 configuration 节的子级。
2065 0