7

In VS Community 2017 (v15.9.26) I am unable to debug as IIS Express Web Server Produces the following error.

Output for IIS Express: Failed to register URL "localhost:xxxxx/" for site. Error description: Cannot create a file when that file already exists. (0x800700b7)

enter image description here

Steps to try to resolve the issue

  1. Clean, Rebuild, Restart VS, Restart Computer
  2. Deleted the IISExpress folder and re-ran VS SA Source
  3. Deleted the .vs folder and re-ran VS
  4. Created a new virtual directory SA Source
  5. Re-cloned repo in a new directory and started from scratch
  6. Running netsh http show urlacl showed no other process using port
  7. Removed the ComponentModelCache from the VS AppData
  8. Re-installed VS Community 2017
  9. Implemented a confirmed working applicationhost.config with updated references to my paths, still same port issue.
  10. Re-installed IIS 10.0 Express
  11. Turned off anti-virus

I should note that I have three startup projects running. Two of the projects (with different ports) run fine so I can rule out firewall or SSL issues. The third startup application only produces this error.

After trying all 7 steps and resting my computer multiple times I am stuck. Any further solutions/fixes to try would be greatly appreciated!

M1lls
  • 545
  • 3
  • 11
  • 33
  • What if you stop anti-virus on your machine? – Lex Li Oct 08 '21 at 20:40
  • @LexLi Since two of my other startup projects run fine I can rule out the firewall, antivirus, SSL issues. Thanks for the ask! – M1lls Oct 08 '21 at 21:01
  • Antivirus products have their own logic to decide what to block, so I don't think you can rule out everything that early. Besides, Windows might reserve port ranges for other applications, https://stackoverflow.com/questions/54010365/how-to-see-what-is-reserving-ephemeral-port-ranges-on-windows – Lex Li Oct 08 '21 at 23:52
  • Turning off Anti-Virus resulted in the same IIS error. I already checked for reserved ports as outlined in step 6. – M1lls Oct 11 '21 at 13:22
  • Step 6 has nothing to do with reserved ranges. – Lex Li Oct 11 '21 at 13:51
  • The port that errors out is not listed in the reserved range. Would you suggest restating winnat service? – M1lls Oct 11 '21 at 14:15
  • I don't suppose you remember how you fixed this do you? – K-Dawg Nov 22 '21 at 11:49
  • 1
    Maybe trial and error testing on port numbers. – Pepe N O Dec 14 '21 at 18:26
  • I assume you're starting VS as admin. When you do a clean, you also manually delete the bin and obj directories to make sure everything is cleaned up successfully? Does it need to be IIS Express? Try switching to Local IIS and hit Create Virtual Directory and see what happens. – Justin Nimmo Dec 15 '21 at 15:20
  • @JustinNimmo can you provide a reference path to what bin and obj dir you are referring to? Are these safe to delete? – M1lls Dec 17 '21 at 18:37
  • 1
    https://stackoverflow.com/questions/5308491/what-are-the-obj-and-bin-folders-created-by-visual-studio-used-for – Justin Nimmo Dec 17 '21 at 20:46
  • 1
    Yes they're safe to delete. Standard source control practice say they should never be checked in. Pretty sure they're included in the base .gitignore template and they'll be recreated on the next build. – Justin Nimmo Dec 17 '21 at 20:48

1 Answers1

2

I found two temporary workarounds in order to bypass the VS error.

  1. Assign a different port number to the application
  2. Comment out the specific binding protocol in the .vs\config\applicationhost.config

I am still looking for a more sustainable solution.

M1lls
  • 545
  • 3
  • 11
  • 33