0
votes

I've created a new MVC 5 project, and I'm trying to configure its Project URL to one that's outside of localhost on my local IIS, e.g. http://alpha.domain.local. This is easily done with a new WebForms project, but MVC 5 is providing some resistance.

I've set an entry in my hosts file:

127.0.0.1    alpha.domain.local

...and I've created the site in IIS with the correct host header:

enter image description here enter image description here

Here's my attempted project configuration:

enter image description here

...and the errors I get when I try to save it:

enter image description here enter image description here

Here's what I get when I just click the Create Virtual Directory button (even though it already exists):

enter image description here

I can ping it:

enter image description here

I can browse to it:

enter image description here

I just can't point my MVC 5 project to it. MVC 5 stubbornly insists I use localhost, which I don't want to do. I've got some infrastructure built up that relies on these custom host names in my local IIS.

This Q&A kind of gets to the point, but not quite.

Like I said, this works great with a new WebForms project (VS 2019, latest build). I've been doing it for years. Now that I'm finally getting started with MVC, though, this is a bit of a wet blanket. I'm going to have to redo a bunch of stuff I can't get it working.

Is this possible? Has anyone else been able to do it?

1

1 Answers

0
votes

OK, got it. (That didn't take long!)

For some reason, an MVC 5 project won't accept a Project URL that's a subdomain, e.g. http://alpha.domain.local, while a WebForms project will.

I switched the URL to http://domain.alpha and it works. You scratch my head, I'll scratch yours. But the problem is solved. Go figure. I'm not going to try to decipher the vagaries of Microsoft.