背景web
本地环境:Win7,Visual Studio 2013, IIS 7.5api
WebForm 项目,添加一个http接口给别人调用。less
个人作法是添加了一个Controller,Application_Start 里面添加路由。测试
而后本地测试经过。ui
发布spa
发布机器环境: Window Server 2008 R2, IIS 7.0.net
发布以后访问接口抛出 404.0 not found 页面。code
网上搜搜解决方案,通常排除方法以下:orm
1. 确认.net framework 4.5 已经安装blog
2. 修改web.config配置
配置system.webServer节点下的modules 和 handlers 节点
<system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
然而上述方法都不能解决个人问题。
以后意识到个人应用程序池配置的4.0 经典模式,经过如下方法解决了问题~
3. 添加通配符脚本映射
或者修改配置
<handlers> ...... <add name="all" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv4.0,bitness64" /> </handlers>