asp.net web api - Why does not MapHttpAttributeRoutes work in Stateless Web API in service fabric? -


by default, vs 2015 templates web api in service fabric create owin based hosting web api controllers. default code in startup.cs file service is:

public static void configureapp(iappbuilder appbuilder) {     // configure web api self-host.      httpconfiguration config = new httpconfiguration();      config.routes.maphttproute(         name: "defaultapi",         routetemplate: "{controller}/{id}",         defaults: new { id = routeparameter.optional }     );      appbuilder.usewebapi(config); } 

i replaced code following:

public static void configureapp(iappbuilder appbuilder) {     // configure web api self-host.      httpconfiguration config = new httpconfiguration();      config.maphttpattributeroutes();      appbuilder.usewebapi(config); } 

and added

[routeprefix("mycontroller")] public class valuescontroller : apicontroller {     ... } 

and try navigate http://localhost:port/mycontroller.

it not work.

the same code works fine when create web api controller asp.net host project.

am doing wrong here?

attribute routing works fine, it's same asp.net whether it's hosted on service fabric or somewhere else. use attribute routing in our party cluster sample. federico commented, make sure have more routeprefix on controllers.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo