Debugging a website on a host from a virtual machine

I have a Windows 7 machine with a Windows 7 virtual machine. I am developing a web application using visual studio 2010 on my host computer. I want to run the application in debug mode and access my local server from a browser in a virtual machine. (The purpose of this is to debug an application that uses Windows authentication using different users without having to log in and out for different users on my main machine ...)

I am using bridging for a virtual machine. I googled how to solve this problem, and most of the streams that I found said that if I used bridged connection, I could access the server on the host machine by simply entering the IP address of my host machine in the URL in virtual machine browser. I tried to use different URLs using the IP address, but none of them worked.

As an example, suppose I run my web application in visual studio on my main machine, and its URL is

http: // localhost: 62789 / MyPage.aspx

Suppose also that I ran ipconfig in CommandPrompt on my host machine and found out that the IP address for my host machine is xxx.xxx.xxx.x. What url should I enter on the virtual machine to access my web application?

Thanks in advance.

EDIT:

I installed IIS to host the web project. After that, I simply added the following line (xxx.xxx.xxx.xxx - my IP) to my hosts file, and I was able to access the website from a virtual machine:

xxx.xxx.xxx.xxx MyWebsite.net

I also had to change the firewall settings.

+4
source share
2 answers

It seems that you can use VisStudio's integrated web server. I'm not sure if this can accept requests from any host except localhost.

Remote computers cannot connect to Visual Studio web server

A simple solution? Use IIS to host your project. After installing IIS (if this is not the case), it is easy to change the project settings to create a virtual directory and debug it in IIS.

+3
source

Personally, it was easier for me to configure my virtual machine using the Microsoft Loopback adapter and assign a virtual machine to this adapter. The guest OS will be assigned its own IP address with DHCP. Using a Loopback adapter will basically put your host system and guest OS on the same network. The guest will only have access to the host and will not be able to access the Internet.

Then you can access the host from the guest using any IP address that you see on the host (run ipconfig/all on the host).

Edit: FYI I am using Virtual PC so that your movement can change. The Loopback Adapter is a free download from Microsoft.

Edit2: You will probably need to open ports on the host machine to also allow access to the web server. Guest OS request will still pass through Windows Firewall

+2
source

Source: https://habr.com/ru/post/1308833/


All Articles