lolol
lolol

Reputation: 4390

Web api routing in subfolder application

I have a main site running under example.com. Now I'm creating a application into example.com subfolder like example.com/subfolder/subsite/, so I have created a application in the subsite folder and everything is working fine, except the routes.

I have the following route:

RouteTable.Routes.MapHttpRoute("myapi", "api/{controller}/{hash}", defaults: new { hash = RouteParameter.Optional });

The route is working fine if I'm debuging the API in localhost or hosting it somewhere else in the root, but it's not working when running inside the subsite application folder.

Any tips?

Upvotes: 3

Views: 1616

Answers (1)

MichaC
MichaC

Reputation: 13380

Did you really create a new web application instead of just a virtual sub directory?

I just tested it, create a simple api controller which returns a string and create a /test site in a /test/sub site, both running the same web api project. And it simply works.

If this is not the issue, please provide more details... error msg etc...

Upvotes: 1

Related Questions