Monday, 23 July 2012

How to access IIS Express sites from the host Mac using VMware Fusion

1. Add a binding to map a host name to the site in the IIS express config

Documents\IISExpress\config\applicationhost.config

Mine looks like
 <site name="MySite" id="2">  
   <application path="/" applicationPool="Clr4IntegratedAppPool">  
     <virtualDirectory path="/" physicalPath="C:\Projects\MySolution\MyWebsite" />  
   </application>  
   <bindings>  
     <binding protocol="http" bindingInformation="*:1314:localhost" />  
     <binding protocol="http" bindingInformation="*:1314:local.mywebsite.com" />  
   </bindings>  
 </site>  

2. Add a firewall rule to allow request on the specified ports
Windows firewall > Advanced settings > Inbound Rules > New Rule

Add a port rule called Local IIS express sites, specify the ports used e.g. 1314
Tip: this same rule can be used for all sites, comma separate the ports

3. Get your IP address of your virtual machine
Go into command line and type ipconfig

4. Edit the host file on mac by entering the following into Terminal
sudo nano /private/etc/hosts
Point your host name to the virtual machines IP
e.g. Add the following line
192.168.180.129    local.mywebsite.com

5. Open Visual Studio using "Run as administrator". This give Visual Studio the permission to map a new host name. Open your project and view in the browser (Ctrl+F5)

6. Open the address in you Mac's browser (including port number)
http://local.mysite.com:1314

No comments:

Post a Comment