Skip to content

Instantly share code, notes, and snippets.

@justingarrick
Last active March 30, 2024 16:24
Show Gist options
  • Star 53 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save justingarrick/6322779 to your computer and use it in GitHub Desktop.
Save justingarrick/6322779 to your computer and use it in GitHub Desktop.
Expose IIS or IISExpress running in a Parallels Windows 7/8 VM to your OS X host

Expose IIS or IISExpress running in a Parallels Windows 7/8 VM to your OS X host

Rename your virtual machine

In your Windows 7/8 VM, go to Control Panel > System > Advanced system settings > Computer Name and click Change. Name this whatever you like, e.g. windows. Restart your VM.

Add an ACL rule

Open CMD or Powershell as administrator. Add a URL ACL entry for your new name on the port of your choice, e.g.
netsh http add urlacl url=http://windows:8080/ user=everyone

Add a firewall rule

Open CMD or Powershell as administrator. Add an inbound firewall rule for this new port.

In Windows 8, the syntax is:
netsh advfirewall firewall add rule name="IISExpressWeb" dir=in action=allow protocol=TCP localport=8080

In Windows 7, the syntax is:
netsh firewall add portopening TCP 8080 IISExpressWeb enable ALL

Configure the IIS binding

If you're using IISExpress, edit your applicationhost.config file, typically found at your Documents\IISExpress\config\applicationhost.config. Find your site under sites, and add a binding to the port using your machine name, e.g.

<bindings>    
	<binding protocol="http" bindingInformation="*:8080:localhost" /> <!-- This will be here already -->
	<binding protocol="http" bindingInformation="*:8080:windows" /> <!-- Add this -->
</bindings>

If you're using IIS, open IIS Manager, find your site under YourMachineName > Sites > YourSiteName. Right-click and select Edit Bindings.... Add a binding with the host name you selected in step 1, e.g. Type: http, IP address: All Unassigned, Port: 8080, Host name: windows. Click OK.

Restart IIS/IISExpress

Startup IISExpress with Visual Studio or restart IIS from IIS Manager and hit your URL from a browser on your Mac/VM Host, e.g. http://windows:8080

Sources

http://stackoverflow.com/questions/3313616/iis-express-enable-external-request http://stackoverflow.com/questions/5442551/iisexpress-returns-a-503-error-from-remote-machines http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

@lokilim
Copy link

lokilim commented Feb 11, 2020

Hi all, currently what i facing is session expired. I able to access to the page and everything, but when i work with function with session, it will lost the session, after refresh.

@guisantos
Copy link

Worked really well to me, thanks!

@backendeveloper
Copy link

Thanks bro, work done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment