我在customerController.cs中有这个
[HttpGet]
[ActionName("GetCustomerNames")]
[Route("api/accounts/myDept/customer/GetCustomerNames", Name = "Get_CustomerNames")]
public HttpResponseMessage GetCustomerNames()
{
...}
在Register.cs中我有这个
public static void Register(HttpConfiguration config, IUnityContainer container)
{
config.Routes.MapHttpRoute(
name: "Get_CustomerNames",
routeTemplate: "api/accounts/myDept/{controller}/{action}",
defaults: null,
constraints: null,
handler: defaultHandlers);
}
在小提琴手中,我使用GET http://localhost:5426/api/accounts/myDept/customer/GetCustomerNames
我得到了400个不好的请求。
我一定错过了什么。请告诉我。谢谢