为了获得404,我做错了什么?
我向我的控制器发出请求:
/// <category>Public Note operations</category>
/// <summary> Gets the public note for the specified entity. </summary>
/// <returns> Note matching unique NoteId identifier. </returns>
/// <example>
/// Sample URI handled by this method is:
/// <code>
/// http://localhost:5001/ooo360/api/v2/Note(4a872b89-f42e-e511-9419-00155d104c97)/attachment
/// </code>
/// </example>
[Route("{entityLogicalName}/({entityGuid:guid})/PublicNotes", Name = "GetPublicNotesForEntity")]
[HttpGet]
public IEnumerable<Annotation> GetPublicNotesForEntity(string entityLogicalName, Guid entityGuid)
{
// there's a breakpoint here that never even gets triggered
return this._PublicNoteService.Get(entityLogicalName, entityGuid);
}
请求的示例是:
http://localhost:5001/ooo360/api/v2/TroubleTicket(058A9570-D373-E511-9420-00155D10416C)/PublicNotes
我做错了什么?
答案 0 :(得分:1)
有待验证的事情:
〜您是否在web api配置中启用了属性路由?
〜在/
和Guid之间不应该有TroubleTicket
- http://localhost:5001/ooo360/api/v2/TroubleTicket/(058A9570-D373-E511-9420-00155D10416C)/PublicNotes
〜您是否设置了正确的路由前缀,以便ooo360/api/v2
得到解决?