I'am running Windows 10 on OS X using Parallels Desktop (network is in SHARED mode). I need to access web applications created on Visual Studio and running on IIS 10 from the host. For example for a generic application running on Windows at http://localhost:1654 I would like to access it from Mac browser with something like http://[ip_virtual_machine]:1654.
The first thing I did was to completely shutdown the Windows firewall, disabled it on public and private networks and also disabled the Firewall service in services.msc. Next I've checked the ip addresses of the host and the virtual machine. Running ifconfig on the Mac I get that the IP address of the virtual machine is 10.211.55.2 while running ipconfig on Windows I get that the IP address is of the VM is 10.211.55.3 (with gateway 10.211.55.1).
I've tried to access the web application using both http://10.211.55.2:1654/ and http://10.211.55.3:1654/ but with no luck. With the former I get a Bad Request - Invalid Hostname response, while with the latter I get ERR_CONNECTION_REFUSED.
In case the firewall was still doing something under the hood, I've also added an inbound rule to allow connections for port 1654, but same result.
I've also noticed one thing: in the applicationhost file in C:\Windows\System32\inetsrv\config\applicationHost.config there is not any reference to my web applications created in Visual Studio. AFAIK when I run a web application in Visual Studio on IIS the binding should be added to the applicationhost file, but there are no entries for any of my web applications. May I have some problems with IIS?
Another thing: the other way around works. I can access a node.js local server on my Mac from the virtual machine using http://10.211.55.2:[port].
But I need to access from Mac to Windows IIS. How can I do that?
The accepted answer didn't work for me, but I finally had success after following the steps outlined here. My setup consists of Parallels 14 running on macOS 10.14.2, and Visual Studio 2017 running on Windows 10.
In summary:
ipconfig
, and copy down your VM's IPv4 address. Then open Settings, go to System > About, and copy down your VM's device name/etc/hosts
file that maps your VM's IP address to its device name, e.g. 10.211.55.3 your-device-name
<binding>
key in .vs/config/applicationhost.config
(note that .vs
is a hidden folder) to use your VM's device name instead of localhost
, e.g. <binding protocol="http" bindingInformation="*:1234:your-device-name" />
netsh http add urlacl url=http://your-device-name:1234/ user=everyone
localhost
, e.g. http://your-device-name:1234/
. Check the box for "Override application root URL" and enter that same URL againC:\Program Files (x86)\Parallels\Parallels Tools\SIA\SharedIntApp.exe
Upon debugging, your app will launch in Safari (or whatever your default Mac browser is) at http://your-device-name:1234
!
Ok I got it working. The additional steps are:
1) Open CMD or Powershell as administrator. Add a URL ACL entry for the port you need:
netsh http add urlacl url=http://*:[port]/ user=everyone
2) The applicationhost file with the bindings in my case is located directly inside the Visual Studio project folder. Specifically it is located at .vs/config/applicationhost.config. Open the file in a text editor and find the line with the bindings information for your application, something like
<bindings>
<binding protocol="http" bindingInformation="*:1654:localhost" />
</bindings>
Add an another entry with the IP of your virtual machine, like this:
<bindings>
<binding protocol="http" bindingInformation="*:1654:localhost" />
<binding protocol="http" bindingInformation="*:1654:10.211.55.3" />
</bindings>
3) (** Optional: may not be necessary ***) In the applicationhost file, find the entry
<section name="anonymousAuthentication" overrideModeDefault="Deny" />
and change it to
<section name="anonymousAuthentication" overrideModeDefault="Allow" />
Now I can access the web app running on IIS from the Mac using http://10.211.55.3:1654 address.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With