c# - ASP.NET CORE, Web API: No route matches the supplied values -
i have problems routing in asp.net core (web api).
i have controller (simplified):
[apiversion("1.0")] [route("api/v{version:apiversion}/[controller]")] public class documentcontroller : controller { [httpget("{guid}", name = "getdocument")] public iactionresult getbyguid(string guid) { var doc = documentdataprovider.find(guid); if (doc == null) return notfound(); return new objectresult(doc) {statuscode = 200}; } [httppost] public iactionresult create([frombody] document doc) { //... creating doc //does not work //var val = createdatroute("getdocument", new {guid = doc.guid.tostring("n")}, document); //or this: createdatroute("getdocument", new { controller = "document", guid = doc.guid.tostring("n")}, document); var val = createdatroute("getdocument", new { version = "1", controller = "document", guid = doc.guid.tostring("n")}, document); return val; } }
if call create, document created , routing object created error "no route matches supplied values" , 500 status.
i can call getbyguid directly, without problems.
i couldn't find debugging asp.net core (like existing routing debugger).
i appreciate help!
edit looks bug microsoft's versioning package.. if define fix route /api/v1/[controller] it's working.
but that's not solution me.
i'll answer own question: bug in versioning package of microsoft , it's gonna fixed soon.
https://github.com/microsoft/aspnet-api-versioning/issues/18
Comments
Post a Comment