【发布时间】:2014-08-20 17:43:56
【问题描述】:
我使用 web api 2 做了一个项目,但后来发现服务器正在运行 2003。所以我现在正在使用 web api 1 (.net 4) 重新创建项目。
我将路由放在 App_Start\WebApiConfig 中
config.Routes.MapHttpRoute(
name: "ContactApi",
routeTemplate: "api/{controller}/{email}/{firstname}/{lastname}/{source}"
);
我使用的网址是
http://localhost:64470/api/Contacts/GetId?email=user5@company.com&firstname=joe&lastname=user&source=wer
这在 web api 2 中运行良好,但出现以下错误 找不到资源
这里是控制器类的一些片段
public class ContactsController : ApiController
public string GetId(string email, string firstname, string lastname, string source)
知道我错过了什么吗?
【问题讨论】:
标签: asp.net-web-api asp.net-web-api-routing