Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

I have a solution with two projects:

  • An ASP.NET MVC3 Web project.
  • An ASP.NET MVC4 Web API project

I would like to know (if its possible) how to configure a route (for instance /api/{controller}/) in the first project (global.asax) in order to be able to use an ApiController on my api project. I dont know what's the routehandler used in a Web API project.

Thanks a lot.

share|improve this question

2 Answers 2

In order to configure a web-api route, go to the WebApiConfig.cs file and create a route.

Here's an example:

config.Routes.MapHttpRoute(
    name: "DefaultApi",
    routeTemplate: "api/{controller}"
);
share|improve this answer

These two projects are separate entities. It's not possible for them both to be hosted by the same server on the same port at the same time. So, either the URL will be different for the projects, or the port will be different. In either case, you wouldn't route to the other project, as much as redirect to the other project, the same way you would redirect to any other website.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.