HTTP Error 500.19报错排查:IIS/VS仍指向已删除路径问题
Fix: VS Debug Shows HTTP 500.19 Instead of Code Error (Stuck on Deleted Path)
I’ve run into a similar frustrating issue before where VS gets stuck referencing a deleted project path, so let’s walk through the most likely fixes step by step:
1. Clean Up IIS Express Configuration
VS Debug often uses IIS Express under the hood, and its config files are a common culprit for stale path references:
- Open the IIS Express config folder at
%userprofile%\Documents\IISExpress\config - Edit the
applicationhost.configfile (use a text editor with admin rights if needed) and search forOurProduct_Bad-Missing-path. Delete any<site>or<application>nodes that point to this deleted path, then save the file. - Check the
%userprofile%\Documents\IISExpress\sitesfolder for any XML files linked to the bad path and delete them entirely.
2. Reset Project Debug Settings in VS
Make sure your project is pointing to the correct path directly:
- Right-click your Web project in the Solution Explorer and select Properties.
- Go to the Web tab:
- If using IIS Express, click the Create Virtual Directory button to ensure it maps to your current valid path (
C:\inetpub\wwwroot\NetApps\AppDir\OurProduct_Release_18.1\SourceDir\LogOnScreen\LogOnScreen). - If using Local IIS, verify the Project URL is correct, click Validate Settings to confirm the path exists, and re-create the virtual directory if needed.
- If using IIS Express, click the Create Virtual Directory button to ensure it maps to your current valid path (
- Delete the hidden
.vsfolder in your solution’s root directory (this stores VS’s debug cache), then restart VS and reload the solution.
3. Remove Stale Entries from Local IIS
If you’re using full IIS instead of IIS Express, check for leftover references:
- Open IIS Manager by running
inetmgrin the Run dialog. - Look in the Sites list for any site pointing to the deleted path and delete it.
- Check the Application Pools section for any pools tied to the bad project path and remove them (double-check you’re not deleting pools for other active projects).
- Open
C:\Windows\System32\inetsrv\config\applicationHost.config(admin rights required), search forOurProduct_Bad-Missing-path, delete any related entries, then restart IIS with theiisresetcommand in an admin command prompt.
4. Clear VS Global Caches
If the above steps don’t work, reset VS’s user-specific cache:
- Open an admin command prompt and run:
Note: This will reset your VS customizations like keyboard shortcuts, so back up your settings first if you care about them.devenv /resetuserdata - You can also check the VS config directory at
%APPDATA%\Microsoft\VisualStudio\<version>(e.g.,14.0for VS2015,15.0for VS2017) for any files referencing the bad path and delete them.
5. Final Verification
After completing the steps above:
- Restart your computer to ensure all cached settings are cleared.
- Open your solution, go to Build > Clean Solution, then Build > Rebuild Solution.
- Intentionally add a small code error (like a syntax mistake in
LogOnScreen) and start debugging. You should now see the code error directly in VS instead of the 500.19 page.
内容的提问来源于stack exchange,提问作者JoeCubicle
相关产品推荐
相关产品推荐

