0

I have setup to entries in my hosts file:

127.0.0.1 mymvcapp.dev www.mymvcapp.dev

127.0.0.1 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

Legenda
  • 89
  • 7

1 Answers1

0

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:

https://www.mywebapi.dev

And entries in the hosts file are needed for each website:

127.0.0.1 mymvcapp.dev

127.0.0.1 www.mymvcapp.dev

127.0.0.1 mywebapi.dev

127.0.0.1 www.mywebapi.dev

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

That's it.

Legenda
  • 89
  • 7