I know this is a clone of the post ASP.net web api 2 Route-Attribute not working , but I am having another issue like this.
I can use the standard api routes if i configure this:
// works just fine
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
// does absolutley nothing
but the config.MapHttpAttributeRoutes();
seems to be doing absolutely nothing. No matter what i have tried so far helps.
Has anybody had this issue?
I have tried all the listed routes using the [Route()]
attribute. Nothing works.
It turned out I was using the wrong namespace.
Must use : System.Web.Http.RouteAttribute What I Used : System.Web.Mvc.RouteAttribute
The answer was posted on the thread which I referenced above - by ed FrenchKevin777
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.