Accessing ASP.NET Development Server from another pc on the network

Viewed 44636

I would like to test my web app in other browsers. I have installed Virtual PC to do just that. the ASP.NET development server does not allow remote connections so the virtual pc (another computer on the network) cannot access the website.

I found this post that was started but there was no solution.

I understand that using localhost will not work. I heard about using the machines ip, but how do I get that correct ip? Look at my lynksys router admin?

If I were to get as far as getting my IP, im sure that the asp.net dev server does not allow remote connections. How do I enable it to do so?

9 Answers

I tried the following that i expected to enable current .net framework [ core / x-platform ] 6.0 release provided asp.net development web server access at least from other machines on local subnet w/o needing to use any 3rd party software enable the port forwarding/proxy to localhost only exposed web server.

I was able to launch the asp.net development web server from windows wsl [ windows subsystem for linux ] distro session and access it using the windows host wi-fi adapter ip address but not from another machine on my subnet, e.g. a vmware linux install operating in bridge mode. It did work if i switched vmware linux install to nat mode.

Any thoughts on why this doesn't allow other hosts access as i expected it would?

netsh interface portproxy add v4tov4 listenport=<tcp port for non-localhost access allowed/enabled in windows firewall> listenaddress=0.0.0.0 < or windows wired/wifi ipaddress > connectport=<tcp port for localhost access to asp.net development web server> connectaddress=localhost 

e.g. netsh interface portproxy add v4tov4 listenport=4430 listenaddress=0.0.0.0 connectport=7146 connectaddress=localhost & netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=5038 connectaddress=localhost 

netsh interface portproxy show all 

// for %i in ( 4430, 8080 ) do ( netsh interface portproxy delete v4tov4 listenport=%i listenaddress=0.0.0.0 )

netsh advfirewall firewall add rule name="Asp.Net Development Web Server Listeners to Expose" dir=in protocol=tcp localport=<csv list of tcp ports allowed/enabled in windows firewall> profile=private|any remoteip=localsubnet|any action=allow [ enable=yes ]

e.g. netsh advfirewall firewall add rule name="Asp.Net Development Web Server Listeners to Expose" dir=in protocol=tcp localport=4430,8080 profile=private remoteip=localsubnet action=allow

netsh advfirewall firewall show rule name="Asp.Net Development Web Server Listeners to Expose" [ or wf.msc | inbound rules ]

// netsh advfirewall firewall delete rule name="Asp.Net Development Web Server Listeners to Expose"

year 2022:

After trying everything on asp.net core .NET 6 side and failed I have found https://mitmproxy.org/

mitmproxy --mode reverse:https://localhost:7053 --ssl-insecure

covers my use case.

on phone and other devices access with http://{your-pc-ip}:8080

Related