6

I don't remeber this being an issue before, and many threads are rather outdated now.

On my Windows 10 installation VS 2019 hosts my project at http://localhost:58402 just fine.

However when I go to change the url under Properties > Debug > App URL to 0.0.0.0:58402 I get the error:

Cannot connect to web server IIS Express

What I have tried:

  1. Running VS 2019 as admin
  2. Restarting computer
  3. Deleting hidden VS folder
  4. Modifying launchSettings.json in my API project properties folder

I can change the port just fine. But as soon as I change localhost to 0.0.0.0 the error occurs.

Reed
  • 1,515
  • 1
  • 21
  • 38
  • How remote is remote: is it on the same LAN (use the computer's IP address instead of 0.0.0.0) or is it on the internet in general? – Andrew Morton Jul 24 '19 at 15:41
  • Is this a duplicate of [How to enable external request in IIS Express?](https://stackoverflow.com/q/3313616/1115360) – Andrew Morton Jul 24 '19 at 15:43
  • Just LAN sorry, yes. – Reed Jul 24 '19 at 15:43
  • @AndrewMorton I have tried all of those answers. The netsh powershell didn't work. The proxy was the best solution but the CORS policy on my devices didn't work well. I'd much rather just expose IIS Express itself to LAN. – Reed Jul 24 '19 at 15:45
  • Could you just use IIS instead of IIS Express? – Andrew Morton Jul 24 '19 at 15:46
  • @AndrewMorton looking into that option currently. Was hoping to just use IIS express to decrease setup overhead when moving computers. – Reed Jul 24 '19 at 15:48
  • Deleting .vs folder won't help much, as VS can still generate you an invalid IIS configuration file. Manually edit it, or use a tool like Jexus Manager https://docs.jexusmanager.com/getting-started/features.html#add-iis-express-from-visual-studio-2015-2017-solution-file. Once you have a valid configuration file, IIS Express should run. – Lex Li Jul 24 '19 at 16:34
  • @Reed Perhaps you could write a small PowerShell script to set up the website in IIS using [New-Website](https://learn.microsoft.com/en-us/powershell/module/webadminstration/new-website?view=winserver2012-ps) etc., assuming you have sufficient admin rights on the computers. – Andrew Morton Jul 26 '19 at 11:04

1 Answers1

2

Update:

I have been using the NPM package iisexpress-proxy with great success now as a daily driver for 5 months now.

Had some difficulty with CORS, but disabling that for local debugging allows me to do everything I would expect.

https://www.npmjs.com/package/iisexpress-proxy

Reed
  • 1,515
  • 1
  • 21
  • 38