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

C#Visual StudioIisWeb Config

C# Problem Overview


I am getting this Kind of Error like::

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

while Debugging any of my Project.

I have also tried after Reinstalling My Visual Studio 2012. But again the same kind of problem I am getting while Debugging.

My System's Configurations are :

  • Windows 8 : 32-bit
  • Visual Studio : 2012

Exception is thrown at the time of Showing Web Page Like,

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.Parameter name: site]
   System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +298

[HttpException (0x80004005): Specified argument was out of the range of valid values.Parameter name: site]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

C# Solutions


Solution 1 - C#

If using IIS:

  • control panel
  • Programs
  • open or close windows features
  • tick internet information services
  • then restart your visual studio

If using IIS Express:

Open 'Add/Remove Programs' from the old control panel and run a repair on IIS Express Or you might go Control Panel ->> Programs ->> Programs and Features ->> Turn Windows features on or off ->> Internet Information Services and check the checkbox as shown in the picture below:

enter image description here

Solution 2 - C#

This occurred to me when I applied the 2017 Fall Creator Update. I was able to resolve by repairing IIS 10.0 Express (I do not have IIS installed on my box.)

Note: As a user pointed out in the comments,

> Repair can be found in "Programs and Features" - the "classic" control panel.

Solution 3 - C#

I had the same issue i resolved it by repairing the iis server in programs and features.

GO TO

Controll panel > uninstall a program and then right click the installed iis express server (installed with Visual Studio) and then click repair.

this is how i solved this issue

Solution 4 - C#

I had the same issue with VS2017. Following solved the issue.

  1. Run Command prompt as Administrator.
  2. Write following two commands which will update your registry.

> reg add HKLM\Software\WOW6432Node\Microsoft\InetStp /v MajorVersion /t > REG_DWORD /d 10 /f > > reg add HKLM\Software\Microsoft\InetStp /v MajorVersion /t REG_DWORD > /d 10 /f

This should solve your problem. Refer to this link for more details.

Solution 5 - C#

Instead of installing the bloated IIS, I get mine resolved by installing Internet Information Services Hostable Web Core from the Windows Features

Solution 6 - C#

When you start with a Specific Page while debugging your project, and you are using Local IIS, you might have filled a wrong value in the Specific Page textbox.

(via Project Properties > Web > Start Action > Specific Page)

Wrong configuration:

Specific Page: "http://localhost/MyApplication/Start/SpecificPage.aspx"
Project Url: "http://localhost/MyApplication"

Right configuration:

Specific Page: "/Start/SpecificPage.aspx"
Project Url: "http://localhost/MyApplication"

Note: Ignore the quotation marks.

Solution 7 - C#

If you are okay with using the built in Visual Studio Development server or you don't want to or cannot install IIS, you can change the web server the project uses by going into

  1. > Project Properties (right click project in solution explorer and select properties)
  2. > select Web tab
  3. > select "Use Visual Studio Development Server".

I don't know how it happened to me, but somehow this option was changed to "Use Local IIS Web Server" for one of my projects.

Solution 8 - C#

This resolved the issue on Windows 10 after the last update

go Control Panel ->> Programs ->> Programs and Features ->> Turn Windows features on or off ->> Internet Information Services

But based on previous response it doesn't work unless checking all these options as on pic below

enter image description here

Solution 9 - C#

For me, it was happening because I had switched over to "Run as Administrator". Just one instance of VS was running, but running it as admin threw this error. Switching back fixed me right up.

Solution 10 - C#

Modify was greyed out for me, but adding the IIS Management Console under programs and features fixed this for me. Also on Windows 10 fall update.

Solution 11 - C#

I got this issue when trying to run a project targeting Framework 4.5 in VS2017. After changing it to Framework 4.6.X it got fixed by itself.

Solution 12 - C#

  • Navigate to Control Panel > Programs > Programs and Features and repair the IIS Express.
  • Restart the visual studio.

To turn on the IIS is not recommended as other comments suggests if you are not using your system as a live server. For development purpose only IIS Express is adequate.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRahul_RJView Question on Stackoverflow
Solution 1 - C#MustafaPView Answer on Stackoverflow
Solution 2 - C#Rich TView Answer on Stackoverflow
Solution 3 - C#tanveer ahmad darView Answer on Stackoverflow
Solution 4 - C#Sikandar AmlaView Answer on Stackoverflow
Solution 5 - C#Johan BakarView Answer on Stackoverflow
Solution 6 - C#WesleyView Answer on Stackoverflow
Solution 7 - C#attilaView Answer on Stackoverflow
Solution 8 - C#Aymen BoumaizaView Answer on Stackoverflow
Solution 9 - C#Michael KView Answer on Stackoverflow
Solution 10 - C#DonView Answer on Stackoverflow
Solution 11 - C#IlluminatiView Answer on Stackoverflow
Solution 12 - C#Ashish DehariyaView Answer on Stackoverflow