1

I have created solution with MVC and WebAPI empty projects.

The MVC one return SPA page which should communicate with WebApi project.

But when I set MVC as startup the WebApi one do not work.

How to do that?

@Edit:

Of course I want to do that:

localhost:xxxx/MVC/Index
localhost:xxxx/API/someapi

2 Answers 2

3

Right-click on the solution in the Solution Explorer and select "Set Startup Projects". In that dialog, set "Multiple Startup Projects" and indicate which projects represent applications you want to start automatically. In this case it would be your two web projects.

Sign up to request clarification or add additional context in comments.

4 Comments

Yes, I did that but the ports are different.
@Nerf: Two different servers can't listen on the same port. Did you mean to put your MVC and WebAPI code in the same project?
Hmm I think I want have API located elsewhere.
@Nerf: If your intent is to have these be separately hosted applications then they're going to have separate addresses. So I guess I don't see what the problem is.
0

In VS.NET Solution Explorer, Right-Click your MVC Project and choose "Set as Startup Project".

For future reference, whatever project name is in bold in Solution Explorer is the startup project.

As David mentioned, your projects will be running on different ports as they should be. By default, VS.NET will use dynamic port assignment, but this behavior can be overridden on the Properties pages of each project.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.