C# ApiController上的Umbraco和Route属性
我在翁布拉科有以下API控制器:C# ApiController上的Umbraco和Route属性,c#,routing,umbraco,C#,Routing,Umbraco,我在翁布拉科有以下API控制器: public class DocumentTypeController : UmbracoAuthorizedApiController { private IServices services; public DocumentTypeController(IServices services) { this.services = services; } // GET: DocumentType
public class DocumentTypeController : UmbracoAuthorizedApiController
{
private IServices services;
public DocumentTypeController(IServices services)
{
this.services = services;
}
// GET: DocumentType
[HttpGet]
[Route("api/documenttype/all")]
public JsonResult<List<DocumentTypeModel>> GetAll()
{
var documentTypes = this.services.DocumentTypeService.GetAll();
return Json(documentTypes);
}
}
当您键入
http://localhost:55262/api/documenttype/all
在您的浏览器中,您看到了什么?是404吗?我不确定您是否可以像这样覆盖Umbraco Web API控制器,因为所有操作都在进行:/Umbraco/backoffice/API/{controller}/{action}
。另一方面,如果我错了,并且这是可能的,那么您是否在RouteConfig
中启用了属性路由,如下所示:routes.mapmvcatteroutes()代码>?当您键入http://localhost:55262/api/documenttype/all
在您的浏览器中,您看到了什么?是404吗?我不确定您是否可以像这样覆盖Umbraco Web API控制器,因为所有操作都在进行:/Umbraco/backoffice/API/{controller}/{action}
。另一方面,如果我错了,并且这是可能的,那么您是否在RouteConfig
中启用了属性路由,如下所示:routes.mapmvcatteroutes()代码>?
$http.get("http://localhost:55262/api/documenttype/all").success(function (data) {
deferred.resolve(data);
});