I am starting to use the MVC4 Web API project, I have several Controller Represents the template class responsible for handling Jason via the Error: When I Several actions found that match the request If I remove one of the above method which works fine. Global.asax I have tried to modify the default routing table in I am requesting using the mail in the field, passing the json in RequestBody for MyRequestTemplate. For this you have to do two things. First [ActionName ("route")] `public class VTRoutingController: ApiController {[ActionName (" route ")] actions with public MyResult PostRoute () The second HttpPost methods With the controller. The controller looks like the following:
Public class VTRoutingController: ApiController {[HttpPost} Public MyResult Route (MyRequestTemplate routingRequestTemplate) {Return Zero; } [HTPOST] Public Myerslt TSPRUT (MyRequentTemplate Routing Reventemplate) {return tap; }}
MyRequestTemplate request.
http: // localhost: 52370 / api / vtrouting / tsproute or
http: // local host: 52370 / API / Vertrolling / Root I get an error:
global.asax , but now I I am also getting the error, I think there is a problem in defining routes at the global level. This is global which I am. Public static zero registrar routes {routes.MapHttpRoute (name: "MyTSPRoute", route title: "API / VTRouting / TSPRoute", default: new {}); Routes MapHttpRoute (name: "myroft", route theme: "API / retreating / root", default: new {action = "Route"}); }
ActionName MyRequestTemplate routingRequestTemplate) to decorate {return tap; } [ActionName ("tspRoute")] Public MyResult PostTSPRoute (MyRequestTemplate routingRequestTemplate) {return tap; }
WebApiConfig defines the following routes in the file.
// Controller of routes such as // `/ api / vtrouting` config.routes.MapHttpRoute (name:" only controller ", MargTemplate:" API / {controller} ") for; To control routes such as // id / controller such as `/ api / vtrouting / 1` config.routes.MapHttpRoute (name:" Controller EndID ", MargTemplate:" API / {Administrator} / {ID} ", default: Odds, barriers: new {id = @ "^ \ d + $"} // integer only); // To handle routes such as // `/ api / vtrouting / route` config.routes.MapHttpRoute with the actions (name:" Controller and action ", MargaTemplate:" API / {controller} / {action} " );
Comments
Post a Comment