WebApi 部署后一直返回404的解决办法
2013-12-07 02:13
197 查看
Fixing ASP.NET MVC 4 Web API 404
Posted on November 5, 2012For a Web Service providing some REST-style URIs to access the data, I decided to use the ASP.NET MVC 4 Web API. Once developed, tested and deployed I experienced a mysterious 404 on my production server.
The Web API started originally as WCF Web API at CodePlex and is finally fully integrated within the latest .NET framework:
“ASP.NET Web API represents the joint efforts of the WCF and ASP.NET teams to create an integrated web API framework. You can get the bits and find articles, tutorials, samples and videos on the new ASP.NET Web API home page. All you have to do is to..”
The tutorials and examples for the ASP.NET Web API are overall easy to understand and you probably get access to the technology very quickly. After I set up my first Web API, which worked absolutely perfect on Windows 8, developed using Visual Studio 2012 and tested with the IIS Express, I was not able to get the bits executed on the deployment server. It’s a Windows Server 2008 R2, IIS 7.5 and a whole bunch of stuff installed using the Web Platform Installer.
Make sure the .NET Framework is installed, probably you missed to install the 4.5 framework on the deployment server. As IIS is set up already, once again it is necessary to register ASP.NET for the latest framework using
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -i
Even now, I got the 404. Eventually, I got the tip to check out how the routing of extensionless URLs work in ASP.NET. By adding
<system.webServer> <modules runAllManagedModulesForAllRequests="true" /> ... </system.webServer>
to the web.config file of my Web API the routing seems to work fine now.
相关文章推荐
- WebApi 部署后页面空白,一直返回404的解决办法
- Linux部署Web应用程序超链接下载中文名称文件404问题解决办法
- Linux部署Web应用程序超链接下载中文名称文件404问题解决办法
- Linux部署Web应用程序超链接下载中文名称文件404问题解决办法
- myeclipse的user library不自动部署到WEB-INF/lib目录下的解决办法
- eclipse部署maven web项目到tomcat服务器时,没有将lib、web.xml复制过去的解决办法
- 在含有WebView、ScrollView和TableView等的Controller中侧滑返回无效,解决侧滑返回,又遇到假死问题的解决办法
- eclipse部署时候不拷jar包到web-inf下面的lib目录解决办法
- 调用"/Windows/wceload.exe /noui /Windows/System_SR_chs_wm.cab"后返回了部署后错误 0x00000001 的解决办法
- weblogic 部署应用时一直停留在部署状态解决办法
- Eclipse导入项目被认为不是Web项目无法部署到Tomcat服务器上的最简单解决办法
- eclipse部署maven web项目到tomcat服务器时,没有将lib、web.xml复制过去的解决办法
- C# post数据时 出现如下错误: System.Net.WebException: 远程服务器返回错误: (417) Expectation Failed 的解决办法
- arcgisAPI 4.5本地部署,图标样式访问不到解决办法!!
- WebView在API 17后调addJavascriptInterface方法无效的解决办法
- C# 模拟post数据提交时 出现如下错误: System.Net.WebException: 远程服务器返回错误: (417) Expectation Failed 的解决办法
- .net返回404错误页面并跳转的解决办法
- Intellij IDEA 部署Web项目,解决 404 错误
- 调用"/Windows/wceload.exe /noui /Windows/System_SR_chs_wm.cab"后返回了部署后错误 0x00000001 的解决办法
- Eclipse部署Maven web项目到tomcat服务器时,没有将lib下的jar复制过去的解决办法