top of page

The Dreaded 'Unable to Connect to Web Server IIS Express' Error

Hey kids! If you've been writing code for more than ... oh ... a month, you'll run into this error. It's persisted in Visual Studio since it was built originally. Developers have been asking for a fix for about 400 years, but no one listens at Microsoft. Which we're pretty used to now.

This is one of the more annoying Microsoft errors to deal with. The error really tells you nothing, there isn't anything in any of the output results or log files that tells you "hey this file is probably corrupt and needs regenerated". Thankfully there is StackOverflow to help during your most favorite times of contemplating your career choice and thinking "I should have been a stripper"

Generally, one of the things listed below will get rid of it. Sometimes, you will need to do them all. But start one at a time.

1. If you are not running Visual Studio as Administrator, you can try to close your instance, then reopen as Administrator. Sometimes just this will knock out the issue without further changes.

Right click on the Visual Studio application and choose "run as administrator".

2. If the error still happens, try deleting the applicationhost file (Example: C:\Repos\solution\.vs\config\applicationhost.config)

Or you can try deleting the entire .vs folder. This holds your local settings for that particular solution.

3. If those don't help, close all instances of Visual Studio you have open. It "should" only be needed to close what you're having an issue with, but I've had to shut it all down as a last resort sometimes.

Navigate to your local source folder (EX: C:\Repos\solution\project\Properties)

Locate the launchSettings.json file in the project that won't open. If you have multiple startup projects in your solution, you'll need to determine which project is screaming at you this time.

Now, delete the file.

Reopen Visual Studio and clean, then rebuild your solution. The launchSettings.json file should regenerate automatically. Then go ahead and run your project / solution. Hopefully this will allow you to get rid of that pesky error and continue coding.

One or all of these changes should reset the problem and allow you to run your localhost as you intend.



bottom of page