添加程序处理映射,把所有的请求直接交由NET框架处理。 (以下红色是web.config核心代码)
<handlers>
<add name="ALL" path="*" verb="*" modules="IsapiModule" scriptProcessor="c:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
</handlers>
用户示例:
<system.web>
<customErrors mode="Off"/>
<authentication mode="None" />
<compilation targetFramework="4.5" />
<httpRuntime targetFramework="4.5" requestValidationMode="2.0" />
<httpHandlers>
<add verb="*" path="*.js" type="System.Web.StaticFileHandler"/>
<add verb="*" path="*.css" type="System.Web.StaticFileHandler"/>
<add verb="*" path="*.jpg" type="System.Web.StaticFileHandler"/>
<add verb="*" path="*.gif" type="System.Web.StaticFileHandler"/>
<add verb="*" path="*.png" type="System.Web.StaticFileHandler"/>
<add verb="*" path="*.jpeg" type="System.Web.StaticFileHandler"/>
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<!--<httpHandlers>
<add verb="*" path="*.js" type="System.Web.StaticFileHandler"/>
<add verb="*" path="*.css" type="System.Web.StaticFileHandler"/>
</httpHandlers>-->
<modules>
<remove name="FormsAuthenticationModule" />
</modules>
<handlers>
<add name="ALL" path="*" verb="*" modules="IsapiModule" scriptProcessor="c:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
</handlers>
</system.webServer>