WebApi 部署后一直返回404的解决办法
Fixing ASP.NET MVC 4 Web API 404
For 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的解决办法的更多相关文章
- 【转】android中重复连接ble设备导致的连接后直接返回STATE_DISCONNECTED的解决办法---不错不错,重新连接需要花费很长的时间
原文网址:http://bbs.eeworld.com.cn/thread-438571-1-1.html /* * 通过使用if(gatt==null ...
- springboot打war包后部署到tomcat后访问返回404错误
springboot打war包后部署到tomcat后访问返回404错误 1.正常情况下,修改打包方式为war <packaging>war</packaging> 2.启动类继 ...
- C# WebAPI中DateTime类型字段在使用微软自带的方法转json格式后默认含T的解决办法
原文:C# WebAPI中DateTime类型字段在使用微软自带的方法转json格式后默认含T的解决办法 本人新手,在.Net中写WebAPI的时候,当接口返回的json数据含有日期时间类型的字段时, ...
- php history.back返回后表单数据丢失的解决办法
js使用history.back返回表单数据丢失的主要原因就是使用了session_start();的原因,该函数会强制当前页面不被缓存.本文章向码农介绍php history.back返回后表单数据 ...
- 关于hexo博客自定义域名后gitment评论系统登陆出现redirect error返回主页的解决办法
title: 关于hexo博客自定义域名后gitment评论系统登陆出现redirect error返回主页的解决办法 toc: false date: 2018-04-16 22:57:50 cat ...
- WPF发布程序后未授予信任的解决办法
WPF发布程序后未授予信任的解决办法 基于浏览器的WPF应用程序由于需要比较高的操作权限,所以在项目的安全性属性中选择了“这是完全可信的应用程序”选项.可是,在发布部署后,在其他电脑上打开xbap文件 ...
- Eclipse中js文件修改后浏览器不能及时更新的解决办法
项目中js文件修改后浏览器不能及时更新的解决办法 转载:http://www.codeweblog.com/%E9%A1%B9%E7%9B%AE%E4%B8%ADjs%E6%96%87%E4%BB%B ...
- MVC3在IIS7.5发布(部署)报403.14错误的解决办法
MVC3在IIS7.5发布(部署)报403.14错误的解决办法 错误现象: 报403.14 forbidden错误 web服务器被配置为不列出此目录的内容. 解决办法: 检查站点的处理程序映射 ...
- CentOS6重启后DNS被还原的解决办法
CentOS6重启后DNS被还原的解决办法 http://luyx30.blog.51cto.com/1029851/1070765/ centos6.5的64位系统,修改完/etc/sysconfi ...
随机推荐
- Unity3D Script Keynote
[Unity3D Script Keynote] 1.创建GameObject if(GUILayout.Button("创建立方体",GUILayout.Height(50))) ...
- 实现LoadRunner多个场景的顺序执行
应用场景假设有3个不同的测试场景,分别为并发登录.核心业务.可靠性测试,3个场景有先后执行顺序.由于白天测试机器另有用处,只能在晚上进行性能测试,这时我们的期望是能否把测试场景都设定好之后晚上自动运行 ...
- HDU 3333 Turing Tree (树状数组)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3333 题意就是询问区间不同数字的和. 比较经典的树状数组应用. //#pragma comment(l ...
- ODBC 是什么
In computing, ODBC (Open Database Connectivity) is a standard programming language middleware API fo ...
- How Tomcat Works(九)
本文接下来描述servlet容器是怎样管理其相关组件的生命周期的,首先本人描述一下事件监听模式,也可以称为观察者模式,该模式分为以下角色 即抽象主题角色 具体主题角色 抽象观察者角色及具体观察者角色, ...
- HDU 1392 Surround the Trees 构造凸包
又是一道模板题 #include <iostream> #include <cstring> #include <cstdlib> #include <cst ...
- Linux 批量添加用户
#!/bin/bashfor i in $(seq 1 50) #会建立1-50的用户douseradd student$i -g studentecho student$i |passwd ...
- hibernate的配置文件
- MFC中修改静态文本框中文字的字体、颜色
假设有一个静态文本框控件,其ID为:IDC_STATIC_XSDJ,且关联一个control类的CStatic类型的变量m_static_xsdj. 设置字体时自然要用到CFont类,下面介绍两种方法 ...
- C#:Func的同步、异步调用(转)
实际开发中,对于一些耗时较长的操作,我们往往会将其封装成异步方式调用,以加速系统响应或改善用户体验,下面是一个示例: 有一个现成的类MyMath,里面有一个Add方法: 1 public class ...