c# - ASP.Net MVC IdentityServer3 broke my webapi routing -
so implementing security on project working on , followed guide identityserver3 add mvc5 application. got through complete setup , thought good, until realized routes in api, unless basic ones, /api/.../ no longer work.
config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}/{id}", defaults: new { id = routeparameter.optional } );
i using default routing, , on various pieces of api controllers have put route attributes guide them in event fall outside of format. example:
[route("api/location/getbyareaincludefilestore/{id}")] public ienumerable<location> getlocationsbyareaidincludefilestore(int id) { if (id <= 0) { return null; } ienumerable<location> locations = _lookupservice.getlocationsbyareaidincludesfilestore(id); return locations; }
and said earlier, prior adding identity server theses worked beautifully. during addition of identityserver had add few nuget packages webapi:
install-package microsoft.owin.host.systemweb install-package microsoft.aspnet.webapi.owin install-package thinktecture.identityserver3.accesstokenvalidation
so question after said , done is, how can fix routes can of information need?
currently have routes
api/controller api/controller/id api/controller/action api/controller/action/id
any amazing, thanks! also, looked through many of other posts , tried lot of variations of routing , attributes before asking question.
add line in webapiconfig config.maphttpattributeroutes();
before config.routes.maphttproute()
.
Comments
Post a Comment