Asp.net-mvc – Visual Studio 2017 – Giving remote users access to website in IIS Express

asp.net-mvciis-expressvisual studiovisual-studio-2017

Been looking through and trying all guides i found on this topic but no luck. I am running and MVC project with HTTPS and want to access the debug site with some remote mobile devices to test out the website. I followed a guide that almost work and i think I am pretty close to getting it to work. Here are the steps I have done:

  • Turn off Firewall
  • Open projectfolder of website go to \vs\config\ and open applicationhost.config
  • Find your site and line that contains your mapped port like this:

-edit it to get this result:

  • Tried to run Visual Studio as Admin at this point, Got regular error 400: Bad Request – Invalid Hostname when trying to access site from other computer
  • Opened CMD as Admin and ran the following command:

netsh http add urlacl url=http://*:44363/ user=everyone
– URL reservation successfully added

-Tried to start Visual studio as admin and non admin. Gets the following error message

"Unable to launch the IIS Express Web Server.
Failed to reister URL "https://localhost:44363" for site "x" Application. Error description: Cannot create file when that file already exists"

-I then have to run cmd again and remove the url with the command:
netsh http delete urlacl url=http://*:44363/

How do i get this to work with Visual Studio 2017 ? I cant be many steps from getting it to work. I have read many guides but none of them works

Best Answer

Amazing how such a simple common need can be so painful to fulfill out of the box in 2017!

Anyway https://github.com/icflorescu/iisexpress-proxy worked nicely for me.

Install it with node:

npm install -g iisexpress-proxy

Then its just something like:

iisexpress-proxy 51123 to 3000

Under 2 mins to get running.