我正在尝试在 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'."}
为什么?