Scott Hanselman

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

June 3, '17 Comments [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
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Saturday, 03 June 2017 13:14:34 UTC
How did you know that would fix it?
Burton
Sunday, 04 June 2017 02:04:09 UTC
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.
Scott Hanselman
Monday, 05 June 2017 07:23:54 UTC
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.
Peter
Monday, 05 June 2017 08:22:51 UTC
you soel a big problem of me. thanks a lot SCOTT
Monday, 05 June 2017 12:08:49 UTC
One more reason why developers are looking forward to running Kestrel in a live environment. Can't wait to get rid of IIS eventually.
Kevin Long
Monday, 05 June 2017 16:09:11 UTC
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.
Bill
Comments are closed.

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