2

Hello and thanks for looking.

Background

I am currently wrapping up a development contract and the client would like for me to push a build of the application to their IIS 7-based server in which they would like to run multiple MVC apps.

One of the issues I have off of the bat is that this server is already a subdomain on their larger network. So, if I enter SERVERNAME in my browser, it automatically directs to SERVERNAME.COMPANYNAME.COM.

Now, this is just fine if I place my application in the default website/root. In this scenario, clicking a link that requests admin.html directs to `SERVERNAME.COMPANYNAME.COM/admin.html' as usual.

BUT they want me to place the app in a subdomain on this server so that they can also run other apps on the same server. So I assume that I need MYAPP.SERVERNAME.COMPANYNAME.COM but I have no idea how to do that.

Complicating matters is that my app and the future ones they wish to install are all MVC based which intercepts and re-writes URLs. I assume that this takes care of itself if I can just successfully get my app into a subdomain to begin with.

What I have tried

  • Creating a new site on the server in it's own app pool
  • Setting the binding for that site to MYAPP.SERVERNAME.COMPANYNAME.COM
  • Setting the binding for that site to MYAPP
  • Setting the binding for that site to MYAPP.SERVERNAME
  • Setting the binding for that site to MYAPP.SERVERNAME.COM
  • Setting the binding for that site to MYAPP.COMPANYNAME.COM

Nothing is working. Am I missing something simple here?

Thanks,

Matt

Matt Cashatt
  • 235
  • 3
  • 7

1 Answers1

1

First thing is are you testing these bindings from the local server? If so, two issues:

  1. For testing purposes you need to be putting your myapp alias in the local hosts file (C:\Windows\System32\Drivers\etc\hosts).
  2. You need to disable loopback protection, which will prevent you from accessing services on a server from itself if you are using a DNS alias. I've got a description of this issue here (it often trips up SharePoint admins). The quick solution (although it disables a minor security feature of Windows) is to run this from a PowerShell (run as administrator) prompt: New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -value "1" -PropertyType dword -Force and reboot.

After that, I would say overall that this isn't related to MVC as much as it is DNS. You can make as many Web Sites in IIS as you want (MVC or other) and make up any DNS names you want as long as you TELL the network DNS servers about the name to IP matches so people can find them.

Sounds like you're used to just putting a site on a server and then using http://servername from other computers on the network. What I always prefer to do is NEVER use the hostname for web apps. I would create a "DNS Alias" in whatever DNS solution the network admin uses (likely Windows DNS Server) to point "appname" to be an alias of "servername". Then in the Web Site binding I put in the host header I want. The advantage here is twofold, I can put more then one web app on a server, and I can then move that web app elsewhere without telling users (just change DNS Alias pointer).

So in your case I recommend http://myapp (assuming it's for internal-only) and in their DNS Zone for companyname.com they just add a DNS Alias (CNAME record) for myapp to point to servername.

If you think it will be accessible from firewall via Internet, then you'll want to use the FQDN like http://myapp.companyname.com. Same steps for DNS apply, you just need to also put it in Internet DNS as well.

I would NOT do sub-domains of the web server name, because that just makes all apps on it tied to that web server (you can't move them without pain for each user in changing their links and habits). There's no less/more work to myapp.companyname.com or myapp.servername.companyname.com so why not make it easier for everyone with myapp.companyname.com. If they tell you it's for identifying the location easier, that's what the DNS Alias is for... just ping myapp.companyname.com and the DNS Alias will cause ping to tell you the REAL server DNS name.

Bret Fisher
  • 3,973
  • 2
  • 21
  • 25
  • Bret--Thank you very much for this help. I am going to put the info in front of some of the IT folks and see what they think. I am just a software dev and not extremely knowledgeable about network configuration. Thanks again! – Matt Cashatt Sep 08 '12 at 21:28
  • PS--I am logging into the server via RDP and testing the bindings from there. – Matt Cashatt Sep 08 '12 at 21:37
  • Yea then the loopback protection is your first task. To temporarily test things w/o server registry changes, RDP to another machine if possible, and change it's hosts file to point myapp to the IP of webserver... then change the IIS Web Site bindings to match the myapp in hostheader and it should work like a champ. The loopback protection issue is only a problem if you want to access IIS sites from the same server they are on. Good luck. – Bret Fisher Sep 08 '12 at 21:58