I am developing webapi using MVC 4. I have doubts about routers. How to get directions to a subfolder under my website. For instance:
www.site.com/Service
My WebApi application is located in the service folder. My main page is working fine, but the API was not found.
Here is my default route:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
I want to call
www.site.com/Service/api/{controllerasket/{ID}
Is there any way to do this?
[Change] I added the service area to the Ares folder, because there already exists an area for HelpPage in the template for WebApi MVC 4. Inside this folder, I added controllers.
Here is the service area class
public class ServiceAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Service";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Service_default",
"Service/api/{controller}/{id}",
new { id = UrlParameter.Optional }
);
}
}
I do not know if this help, my site www.site.com is just a website, I added and converted this folder to an application on my iis. [/ Edit]