How to use localhost on my mac from inside Parallels

Discussion in 'Installation and Configuration of Parallels Desktop' started by ShawnH10, Feb 12, 2024.

  1. ShawnH10

    ShawnH10 Bit poster

    I need to use a web app locally with .NET 4.7 so it has to be done in Windows. The database it is accessing is on a container on my mac (which I use for multiple databases). I would like to avoid running a separate SQL server inside a docker container inside the VM if possible.
    I can connect to the database from within the Windows VM if I type in the IP with port as the server, but it will not work if I type in localhost, either with or without the port.
    The trouble is if I move to a few different locations during the week and as such my IP changes from location to location. Reconfiguring my web.config every time I move to a new location so getting localhost to work would be beneficial.
    I have "shared network" selected and in "advanced" I have "connect mac to this network" selected. I was going to share a screenshot but it did have IPs and I didn't know if that was sensitive info.
  2. AlexandrB

    AlexandrB Bit poster

    Add a line to your hosts file (C:\Windows\System32\drivers\etc\hosts) host is a default IP Parallels assigns to host machine, "host" could be anything you like - this will allow you to connect to your Docker on Mac OS from your WIndows VM using host:[port]

Share This Page