Parallels Desktop comes in three editions: Desktop 12 for Mac, Pro and Business. Pro increases virtual RAM support up to 64GB, and Business adds on centralized administration and management, along. I'm running a Windows 10 VM using Parallels. I'm building an API on the windows machine and a mobile app on OSX. I need to call the Windows localhost from OSX in order to test out my API calls.
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:WindowsSystem32inetsrvconfigapplicationHost.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?
2 Answers
Parallels For Mac Localhost Ports
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:
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
Add an another entry with the IP of your virtual machine, like this:
3) (** Optional: may not be necessary ***) In the applicationhost file, find the entry
and change it to
Now I can access the web app running on IIS from the Mac using http://10.211.55.3:1654 address.
Hope this helps.
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:
- In Parallels, make sure your Network type is set to 'Shared Network' and that 'Share Mac applications with Windows' is enabled
- In your Windows VM, open PowerShell, enter
ipconfig
, and copy down your VM's IPv4 address. Then open Settings, go to System > About, and copy down your VM's device name - In macOS, add an entry to your
/etc/hosts
file that maps your VM's IP address to its device name, e.g.10.211.55.3 your-device-name
- Back in your Windows VM, in the folder for your Visual Studio project, edit the
<binding>
key in.vs/config/applicationhost.config
(note that.vs
is a hidden folder) to use your VM's device name instead oflocalhost
, e.g.<binding protocol='http' bindingInformation='*:1234:your-device-name' />
- Open PowerShell as an administrator and run the following command to enable external access, using your VM's device name and the port from step #4:
netsh http add urlacl url=http://your-device-name:1234/ user=everyone
- Open Windows Firewall and add new inbound and outbound rules for your project. For both rules, select 'Port' as the rule type and 'TCP' as the protocol, enter the port from step #4, and select 'Allow the connection'
- In Visual Studio, go to your project's properties, click the 'Web' tab, and change your project URL to use your Windows device name instead of
localhost
, e.g.http://your-device-name:1234/
. Check the box for 'Override application root URL' and enter that same URL again - Debug your project using the 'Open in Mac' browser. If you don't see this option, click 'Browse With...', then 'Add...', and then add an entry that points to
C:Program Files (x86)ParallelsParallels ToolsSIASharedIntApp.exe
Upon debugging, your app will launch in Safari (or whatever your default Mac browser is) at http://your-device-name:1234
!
Not the answer you're looking for? Browse other questions tagged iislocalhostvirtual-machinefirewallparallels or ask your own question.
Information
Virtual machine can use three different networking modes depending on user needs:
To switch between network modes go to macOS menu bar when virtual machine is active > Devices menu > Network.
Note: configuring Shared and Host-Only networks is available in Pro Edition in Parallels Desktop Preferences > Network.
Shared Networking
This is the default and recommended network mode for virtual machines, as it does not require any specific configuring and works 'out of the box'. When this networking mode is used Parallels Desktop will work as a virtual router for your virtual machine. As a result:
- Parallels Desktop creates a separate virtual subnet with its own virtual DHCP server running in macOS.
- A virtual machine belongs to that virtual subnet with its own IP range.
- A virtual machine is not visible in the real subnet the Mac belongs to.
- A virtual machine use full Internet access.
- If Mac is connected to virtual private network - VPN access is automatically shared with virtual machine.
This network mode is suitable for most of user needs.
Bridged Network
When this network mode is used, your virtual machine uses a virtualized network interface card with direct access to Internet. As a result:
- A virtual machine appears as a separate computer that belongs to the same subnet as the Mac it is running on.
- A DHCP server (e.g., your router) provides a virtual machine with an IP address within the same IP range as other computers in the same subnet.
- A virtual machine can ping and see all computers in the subnet.
- Other computers can ping and see the virtual machine.
Note: when selecting this network mode Parallels Desktop is no longer responsible for network connectivity issues.
Bridged network can be enabled on a particular network interface, such as Ethernet, Wi-Fi or other Mac network interfaces.
- Bridged: Ethernet corresponds to your Mac Ethernet adapter
- Bridged: Wi-Fi corresponds to your Mac Wi-Fi adapter. (may work unstable depending on router settings)
- Bridged: Default Adapter corresponds to whichever network adapter is chosen as the default (the first in the list System Preferences > Network) on the Mac.
Host-Only Network
This mode is similar to Shared Network except that this virtual subnet (10.37.129.x) is isolated from the outer world. As a result, the virtual machine that is working in host-only mode can only see and ping other virtual machines and communicate with the gateway (10.37.129.1).
Additional information
The networking technology basics below should help you decide which networking mode to choose.
When talking about networking we often use terms like IP address, DHCP Server, subnetwork, and many others. The first three are the most important in our case.
IP address
A numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol (IP) for communication.
IP addresses are represented in dot-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots, e.g., 192.168.0.10. Each part represents a group of eight bits of the address. IP addresses, like regular addresses, are used by computers and other devices to communicate with each other.
An IP address can be assigned to a network device (e.g., computer, printer, tablet, smartphone, etc.) either manually by a user or a System Administrator, or automatically by a DHCP server. To see the IP address of your Mac, go to System Preferences > Network.
Your Mac will normally use either a Wi-Fi connection:
or an Ethernet (cable) connection:
DHCP server
A computer or a specific network device (router) that maintains a database of available IP addresses and configuration information. When the server receives a request from a client device (e.g., computer, printer), the DHCP server determines the network to which the DHCP client is connected, and then allocates an IP address that is appropriate for the client, and sends configuration information appropriate for that client.
In an average home network your router will work as a DHCP server that automatically assigns the IP addresses to all your network devices so that you do not need to worry about the IP addresses and other necessary settings for your Mac or a smartphone.
Subnetwork (subnet)
A logically visible subdivision of an IP network. The practice of dividing a network into two or more networks is called subnetting.
All computers that belong to a subnet are addressed with a common, identical, most-significant bit-group in their IP address. For example, a typical home subnet will have IP addresses in the following range: 192.168.0.1-255. This means your Wi-Fi router will have an IP address of 192.168.0.1, your MacBook Pro® will have an IP address of 192.168.0.10, your smartphone - 192.168.0.20 and your wireless printer - 192.168.0.30. To learn more about the settings of the DHCP server, please read your router's documentation.
Traffic between subnetworks is exchanged or routed with special gateways called routers, which constitute the logical or physical boundaries between the subnets.
Network adapters (NIC) types in virtual machine configuration explanation
In virtual machine configuration you can choose between 4 types of network interface card (NIC):
Virtio network adapter is the fastest card. However, it works only in Linux and BSD guest operating systems. It is a default adapter for Linux-based OSes.
Intel® PRO/1000 MT is a default network adapter for Windows and Mac OS X virtual machines. It works in all operating systems. It also counts a checksum and splits packages. Thus it allows to increase the network performance.
Intel® Gigabit CT (82574L) Support for this network interface was added in Parallels Desktop 11 for Mac. This is Intel's e1000e Ethernet driver.
Parallels For Mac Localhost Cups
Realtek RTL8029AS is the simplest adapter from the list. It does not count a checksum or split packages. The Realtek adapter can be used only if you have Parallels Tools installed in your virtual machine. Without Parallels Tools it will work very slow or even will not work at all. It works especially good with Windows XP virtual machines.