So you have an IIS website hosting an ASP.NET application on your guest Windows virtual machine but you're running a mac and want to be able to view the site using a browser on OS X? I previously acheived this through an array of complex configuration settings and in years gone by would often forget what it was I needed to do to configure it again when I move from old Mac to new Mac. But now I reckoned that I would write an article with some reproducible steps so that people (mainly me) can come back to this article in the future and follow these steps verbatim and not have to worry about it.
So first thing is to setup your website in IIS. The most important thing here to set the website to have a binding to all IP addresses and to ensure that the port is set to 80 (default http port).
If you want to add in HTTPS bindings (if you need to) on port 443, then now is the time to do it. Then go into the virtual machine's configuration settings (find the VM menu in the OS X menu bar and go to "Configure..").
Go to the Hardware tab and click on Network 1. Here you want to set your network adapter type to Default Adapter under the Bridged section. I previously used the Shared Networking mode but this method was just easier.
Next up, if you don't give a shit about your VM's firewall security (like I do) then go into Windows Firewall with Advanced Security and turn off your Windows firewall for all profiles (the three profiles are Domain, Private and Public). The "turn off" feature can be found under the "Windows Firewall Properties" link. Inside of the dialog, turn off the firewall for all three of the above profiles, going through the tabs at the top and selecting "off".
Now open up your Windows command prompt and type:
You will be given loadsa details about your networking situation. Take a note of the IPv4 address as you will need it later. (My IPv4 address is `192.168.1.115`).
Now back on OS X, go to Finder and hit shift + cmd + g to pull up the Go To Folder dialog. Type `/etc/hosts` and hit Go. You will be taken to the etc folder and the hosts file will be highlighted. Drag the file into Sublime Text or another text editor and add a new line into the file, taking care not to disturb any of the existing entries. This is where you give your Mac a nicer looking address to translate into the proper IP address of your IIS site in your Windows VM. So you would add a line to the hosts file like below:
# Parallels Windows VM IP address 192.168.0.16 myaspnetdevelopmentsite.dev # End Parallels Windows VM IP address config
Setting a static IP address on Windows
Finally we need to tell Windows that the local IP address the Windows VM is using on our network should not change.
We do this by going into the Control Panel > Network and Internet > Network Connections and right clicking on the LAN connection we are using and clicking "Properties". There we set the static local IP address to be the IP address that we took note of earlier.
Also ensure that we set the system DNS to use Google's primary and secondary DNS servers:
A full guide on how to make the Windows IP address static can be found at http://www.faqforge.com/windows/configure-static-local-ip-on-windows-7/
Now load up your browser in OS X and visit myaspnetdevelopmentsite.dev and you should see your IIS development site!