VS Community 2017中无法启动IIS Express Web服务器:URL注册失败(文件已存在错误)求助
Hey there, let's tackle this frustrating IIS Express issue you're dealing with. Since your other two launch projects work perfectly, we can focus our efforts specifically on that problematic third project. Here are some targeted steps you haven't mentioned trying yet—give them a shot:
Inspect and modify the project's
launchSettings.json
Navigate to your third project's root directory, openProperties/launchSettings.json, and check theiisSettingssection'sapplicationUrl. Make sure there are no duplicate entries for the problematic port, and try swapping the port number to a completely unused one (you can pick a random number between 49152-65535, which are dynamic/private ports). Save the file and restart debugging.Clean up duplicate bindings in
applicationhost.config
Locate theapplicationhost.configfile (it's either in%USERPROFILE%\Documents\IISExpress\configor your project's.vs\configfolder). Search for your third project's site name, then check the<bindings>node. If you see multiple<binding>entries forlocalhost:xxxxx/, delete the duplicates, leaving only one valid binding. Save the file and try launching again.Force-release the URL reservation via command line
Open Command Prompt as Administrator:- Run
netsh http show urlaclto find the reservation entry forhttp://localhost:xxxxx/ - Execute
netsh http delete urlacl url=http://localhost:xxxxx/to remove that reservation - Restart Visual Studio and try debugging the third project—this lets IIS Express re-register the URL from scratch.
- Run
Verify the project's virtual directory uniqueness
Right-click your third project in VS, go to Properties > Web. Under the IIS Express server settings, check the virtual directory name. If it's identical to another project's virtual directory, rename it to something unique (e.g., add a-v2suffix). Also double-check that the physical path points correctly to your project's output folder with no duplicate paths elsewhere.Check HTTP.sys event logs for detailed conflict clues
Open Event Viewer, navigate to Windows Logs > System, then filter events by the source "HTTP". Look for events related to your target port—they might reveal exactly what's holding onto the URL or causing the file conflict error, which could be a hidden service or leftover system entry you missed.Reset IIS Express to default configurations
Open Command Prompt and runiisexpress /resetto wipe all custom IIS Express settings. After the reset completes, reopen VS, reload your solution, and reconfigure the third project's launch settings before attempting to debug.
内容的提问来源于stack exchange,提问作者M1lls

