I have setup to entries in my hosts file: mymvcapp.dev www.mymvcapp.dev mywebapi.dev www.mywebapi.dev

In the first I want to host my mvc app and the second entry is for my web api app. Now I have added these two bindings to my IIS8, so all in all 4 bindings one with www and one without for each application in the default website in IIS.

The problem is when I try to access any of these urls above, they point me to the mvc application. Now in VS I try to change the virtual directory for the WebAPI project, but this also changes the bidning of my mvc app. When I do this, now I can connect to my web api, but when I use the mvc app url I get the web api.

How to configure this right?

Web api project in VS

1 Answer 1


I have removed the "mywebapi.dev" bindings from the default website. Added a new website beside the default website with the mentioned http/https bindings. Not sure if this is necessary. Added a new application whose physical path maps to my web api project folder. In the project properties -> Web tab I choose IIS and entered the project url:


And entries in the hosts file are needed for each website: mymvcapp.dev www.mymvcapp.dev mywebapi.dev www.mywebapi.dev

In the respective website you need a binding for both hostnames. One with and the other without "www"!

That's it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .