I am using WebAPI 2 with Attribute routing in my project. I deployed my project under a virtual directory in IIS. I need to remove virtual Directory name from the URL. Now my URL is api.mydomain.com/virtualdirectory/{controllerName}/{Version} In my Route Prefix I am passing controllerName/Version. I need to change the URL to api.mydomain.com/{controllerName}/{Version} Please help me how can i achieve this using attribute routing.
1 Answer
The question is will a request like api.mydomain.com/{controllerName}/{Version} hit your action?...route templates(with conventional or attribute routing) are always relative to the base path of your application and if the base path of the application includes the virtual directory, then the request urls would need to have this information to hit the actions...one option i can think of is to host your application directly under the website...
3 Comments
Jijil PK
My Application should go under the virtual directory. For some of the controllers I need to rename the virtual directory name with the controller name.
Yann Duran
I have the same requirement, & I'm experiencing the same problem - googling all I can to find a way to make it work (my search led me here)
Axel
@Kiran Please do you think you could help me with this question stackoverflow.com/questions/26835211/…