Expose IISExpress to Mac from a Windows Virtual Machine
While working on an iOS app I bumped into a situation where I needed to consume a .NET web service on my Windows Virtual Machine hosted on IISExpress. After searching in internet I couldn’t even find one solution that was pleasing to my eyes. Since I was using Nancy Web Framework (the coolest .NET web framework out there), I almost went to even coding in MonoDevelop in Mac as Nancy official supports Mono. But since I like to have my dev environment similar to my production environment I insisted on using a Windows box.
There was even a solution using Powershell (which I think is one of the worst shell on the planet. @GrumpyDev sums it well. I removed some of my replies as it was not related to this context.)
First of all you would want to install the Bonjour Print Services for Windows. You can download it from http://support.apple.com/kb/DL999. This will allow you to access your windows machine from mac using computername.local like shown below from mac. (Below is the default full IIS8 homepage.)
In my case computer name is pswin8mac.
And then I found this bat script https://gist.github.com/3725469 by Duncan Smart which is as simple as double clicking it in an admin mode. Save this as a add_urlacl.cmd file name and run it using admin mode. You will then be prompted to enter a port number. Type the port number and press enter.
:: NOTE needs to be elevated
@set /p HTTP_PORT=Enter Port number [e.g. 10082]:
@rem install http://support.apple.com/kb/DL999 so you can access computername.local from mac
netsh http add urlacl url=http://*:%HTTP_PORT%/ user=everyone
netsh http add urlacl url=http://localhost:%HTTP_PORT%/ user=everyone
netsh http add urlacl url=http://%COMPUTERNAME%:%HTTP_PORT%/ user=everyone
netsh http add urlacl url=http://%COMPUTERNAME%.local:%HTTP_PORT%/ user=everyone
@pause