【发布时间】:2014-01-26 16:18:55
【问题描述】:
我正在尝试在 PluralSight.com 上学习 John Papa 的 SPA 课程,但遇到了这个奇怪的问题。
public class LookupController : ApiControllerBase
{
// GET: api/lookup/samples
[ActionName("samples")]
public IEnumerable<Sample> GetSamples()
{
return Uow.Samples.GetAll().OrderBy(x => x.Name);
}
}
如果我使用localhost:49210/api/lookup/getsamples 并获得样本列表。但是,当我使用localhost:49210/api/lookup/samples 时,出现以下错误:
{"message":"No HTTP resource was found that matches the request URI
'http://localhost:49210/api/lookup/samples'.","messageDetail":"No
action was found on the controller 'Lookup' that matches the name
'samples'."}
为什么?
【问题讨论】:
标签: c# asp.net-web-api asp.net-web-api-routing