I'm building a MVC web application that should respond to domains like a.sub.example.com, b.sub.example.com, c.sub.example.com etc. I'm ok figuring out how to get out the a,b,c etc prefix and create a proper route accordingly, but I'm struggling to get the IIS webserver to actually forward the requests to the same webapplication.
I followed this guide to make IIS express listen to another address, in this case sub.example.com, which works fine. However, I cannot figure out how to get it to listen to all subdomains of that one. When I direct my browser to a.sub.example.com, I get an error:
HTTP Error 400. The request hostname is invalid.
I added both sub.example.com and a.sub.example.com as aliases for 127.0.0.1 in my hosts file.
My applicationhost.config file's 'site' entry looks like this:
<site name="MyProject.Web" id="7">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="..." />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:8888:sub.example.com" />
</bindings>
<applicationDefaults applicationPool="Clr2IntegratedAppPool" />
</site>
When I replace the 'bindingInformation attribute with
"*:8888:*.sub.example.com"
as the previously mentioned guide suggests I should do when I want IIS express to listen to multiple domains, IIS Express fails to start at all.
Am I missing something obvious here?