在internet上布署web API作的站点时,发现不能调用web api的任何action, 返回404. 通过不少的努力,也找不到缘由,环境是win server 2008, IIS 75. net framework 4.5. 后来,在网上找了一个答案,试了下,能够,但仍是不知道缘由,由于在公司里面的服务器布署都没有问题,只是在IDc提供的虚机才出现这种问题,并且是全部的机器都是同样的问题。解决办法:web
在web.config中api
Adding the following to the web.config file worked for me:服务器
<system.webServer> <modules> <remove name="UrlRoutingModule-4.0" /> <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" /> </modules> </system.webServer>参考:http://stackoverflow.com/questions/9703090/http-404-page-not-found-in-web-api-hosted-in-iis-7-5