Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 632
lolol Avatar asked Sep 24 '26 22:09

lolol


1 Answers

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...

like image 112
MichaC Avatar answered Sep 26 '26 13:09

MichaC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!