Scott Hanselman

Visual Studio and IIS Error: Specified argument was out of the range of valid values. Parameter name: site

June 03, 2017 Comment on this post [6] Posted in Bugs | IIS
Sponsored By

I got a very obscure and obtuse error running an ASP.NET application under Visual Studio and IIS Express recently. I'm running a Windows 10 Insiders (Fast Ring) build, so it's likely an issue with that, but since I was able to resolve the issue simply, I figured I'd blog it for google posterity .

I would run the ASP.NET app from within Visual Studio and get this totally useless error. It was happening VERY early in the bootstrapping process and NOT in my application. It pretty clearly is happening somewhere in the depths of IIS Express, perhaps in a configurator in HttpRuntime.

Specified argument was out of the range of valid values.
Parameter name: site

I fixed it by going to Windows Features and installing "IIS Hostable Web Core," part of Internet Information Services. I did this in an attempt to "fix whatever's wrong with IIS Express."

Turn Windows Features on or off

That seems to "repair" IIS Express. I'll update this post if I learn more, but hopefully if you got to this post, this fixed it for you also.


Sponsor: Check out JetBrains Rider: a new cross-platform .NET IDE. Edit, refactor, test, build and debug ASP.NET, .NET Framework, .NET Core, or Unity applications. Learn more and get access to early builds!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
June 03, 2017 17:14
How did you know that would fix it?
June 04, 2017 6:04
Burton - Because it's the equivalent of a "Repair" on IIS itself. I suspect something got corrupted or laid down wrong between Builds of Windows 10, since I'm on the Beta Train.
June 05, 2017 11:23
I know IIS Express allows you to run VS without admin, but I have to admit I never ever run web code through IIS express. The first thing I do on a project is configure it to use real IIS. My theory being - develop as close as you can to your target deployment platform.

To late now, but I wonder if real IIS would have worked in this case.
June 05, 2017 12:22
you soel a big problem of me. thanks a lot SCOTT
June 05, 2017 16:08
One more reason why developers are looking forward to running Kestrel in a live environment. Can't wait to get rid of IIS eventually.
June 05, 2017 20:09
I'm on Windows 7 using VS 2017 and have seen the same message. My fix is to close VS then delete the applicationhost.config file in the hidden ".vs" folder under the solution folder. This fixes the problem for me. Deleting the whole ".vs" folder works too.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.