260

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
Adam
  • 28,537
  • 15
  • 60
  • 73
Rahul_RJ
  • 2,795
  • 3
  • 14
  • 10

12 Answers12

533

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

Adil B
  • 14,635
  • 11
  • 60
  • 78
MustafaP
  • 6,623
  • 4
  • 25
  • 39
  • 4
    Worked well. Visual Studio should have tell that straight forward. IIS is not enabled. Thanks Man – Zahid Riaz Mar 27 '14 at 16:16
  • Thank you, it worket for me too. Why IIS Express needs IIS installed? I don't understand that. I use default web.config, nothing special. – Václav Dajbych Jun 06 '14 at 14:35
  • I know this is an old answer, but I recently encountered this error. With me, the fault was that I was trying to run 2 different websites in 2 different visual studio solutions. I think IIS Express only allows for 1 concurrent visual studio solution to run at once. So, when you need to have 2 solutions active on IIS, you need to enable IIS using the windows features. If not, you just have to make sure there's only one solution running on IIS Express at any given time. – Tsasken Jul 04 '14 at 07:20
  • Same as Tsasken, I just got it a bit earlier today. Thanks to MustafaP for the answer and in general to Stackoverflow and associated sites for the help I've had!!! fixed the prob in 30 min since it popped up. – bbbwex Aug 28 '14 at 16:26
  • 41
    After a Windows-update this issue got me. Solution still works today! Windows 10 Pro Insider Preview Build 16199.rs_prerelease.170513-2252 – timbillstrom May 18 '17 at 08:22
  • 21
    You don't need *all* of IIS, you can just install IIS Management Console (IIS --> Web Management Tools --> IIS Management Console). – jpda May 19 '17 at 15:28
  • 11
    I also received this error after updating to 'Windows 10 Pro Insider Preview Build 16199.rs_prerelease.170513-2252'. Added 'IIS Management Console' as recommended by JPD. Problem solved. – BobK May 25 '17 at 22:16
  • 3
    Crazy! This question was asked 4 years ago and the issue resurfaced again in Insider Preview Build – Boris Lipschitz Jul 24 '17 at 00:34
  • 2
    Just had this issue on Insider Preview Build 16257.rs3_release.170728-1700 so it is still occurring! – Kevin Coulson Aug 21 '17 at 09:30
  • Got it with Windows 10 Pro Insider Preview Evaluation copy. Build 16281.rs3 release.17D82g-1438. Thank for this solution. I also only installed the IIS Management Console. – Bastien Vandamme Sep 06 '17 at 03:57
  • 14
    Got the error with the Win10 Fall creators update, installing only the "Hostable Web Core" did the trick. Thanks ;) – LucasMetal Oct 18 '17 at 22:00
  • 2
    GOD DAMN YOU MICROSOFT GOD BLESS YOU GUYS – akokani Oct 30 '17 at 16:31
  • 4
    After updating to Windows 10 Fall Creators Update, repairing IIS Express sorted my issue. Many thanks! – Code Animal Nov 01 '17 at 15:51
  • 41
    4 years later and the answer still holds up. Windows 10 Update installed and IIS went away. Seriously, WTF MS... – Mike Devenney Nov 02 '17 at 01:23
  • Solution still works for Windows 10, version 1709 (OS Build 16299.64) – Fidel Garcia Nov 19 '17 at 19:32
  • 1
    Didn't have to restart VS – Stefanvds Nov 20 '17 at 05:30
  • 5
    Repair IISExpress fixed this for me too after Fall Creators Update. – Will Appleby Nov 27 '17 at 19:56
  • lovely, system update screwed me too :) lack of coffee made me just google the exception and I'm glad I did as I would have never thought of IIS being the issue ! – aspirant_sensei Dec 05 '17 at 10:51
  • 3
    5 Years later, and still the same issue (and solution), Windows Automatic Update and BOOM – Chtioui Malek Dec 14 '17 at 22:00
  • I really think that Microsoft has a few old people collecting fat paychecks and stuff like these are run by bunch of students and interns. How the hell can this happen. – TheMentor Dec 15 '17 at 19:45
  • Still holds true. Faced this error after running a Windows update. – Nitesh Dec 18 '17 at 18:20
  • Happened to me too after a Windows up with IIS Express. I had to install the windows feature 'IIS Hostable Web Core' in order to fix the issue. Merely reparing/uninstall/install/combinations didn't fix it. But installing the windows feature seems to "repair" IIS Express. – Mr. Young Dec 19 '17 at 21:26
  • I always faced same issue after updating my Windows 10 Pro – Alaa' Dec 21 '17 at 09:53
  • 1
    Just an FYI; I received a Windows Update this morning, and thereafter I had this issue. As others have suggested, using the Repair option Control Panel still works. In my case, I ran a repair on the program titled "IIS 10.0 Express". – DanielG Jan 16 '18 at 14:45
  • 1
    2018 here - windows 10 pushed an update out last night. This problem came to be. This solution still worked. Thank you. – AhabLives Jan 24 '18 at 17:06
  • I upgraded my windows and had the same problem. The answer is still valid! – Geovani Anholete Jan 30 '18 at 00:52
  • -1 Despite being an old answer, it would be better to specify which options to turn on, as the _tick_, being a square, means that only some options are active, and not all. In order to prevent turning on something we don't want, security reasons for instance, it would be better if someone could supply the full tree of active options. – auhmaan May 02 '18 at 19:57
  • Thank you for this, it actually solved my issue right away. Regardless, it's worth noting that if you use localhost alongside other frameworks and programs, **port 80 will be blocked by IIS**. – Thanos Paravantis May 16 '18 at 15:40
  • Enabling IIS Express and restarting didn't work for me. Tried the repair option and Windows refused to do it. Downloaded the Program Install and Uninstall Troubleshooter as described here: https://www.thewindowsclub.com/cannot-install-uninstall-programs-windows-7 and uninstalled IIS Express. Then downloaded IIS Express and re-installed. Then it worked. Surprising how often tasks that should take minutes take hours when Microsoft products are involved. – UserX Oct 02 '18 at 21:29
  • I'm using IIS and this method is solved my above issue. Thank you – Sumith Harshan Oct 10 '18 at 11:24
  • @ZahidRiaz have you ever seen the error in which Visual Studio says: "Catastrofic Failure." and closes itself? You might think the world would end after this message, but you then just reopen VS and everything is nice again. – Ulysses Alves Oct 16 '19 at 13:25
166

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.

Community
  • 1
  • 1
Rich T
  • 1,711
  • 1
  • 11
  • 5
  • 45
    Repair can be found in "Programs and Features" - the "classic" control panel. – user2006616 Oct 22 '17 at 04:13
  • 4
    Same here! Repairing IIS 10.0 Express fixed. Thanks! – Vitor Rigoni Oct 22 '17 at 08:16
  • 4
    This is the solution for IIS Express, works as explained. Since we cannot have two official answers, I have added this to the official answer. – Stefan Z Camilleri Oct 25 '17 at 20:10
  • 1
    Repairing IIS Express would crash the installer for me. I had to uninstall/re-install IIS Express using the Visual Studio 2017 installer under the individual components section. It will tell you other components need to be uninstalled as well. Make note of them and and then proceed with uninstall/re-install of the components. – Thomas927 Oct 26 '17 at 15:03
  • 3
    I ended up downloading the stand-alone installer for IIS 10.0 Express and doing the uninstall/re-install using that instead of letting the VS installer removed the other things. Everything seems to be working out so far. – Brent Keller Nov 08 '17 at 21:23
  • 1
    Don't you think it's completely ridiculous that you have two interfaces for Add/Remove programs in one system and they have different features (you can't repair from "new" one)? – Episodex Nov 17 '17 at 08:47
  • 1
    Make sure you shut down IIS Express before you repair it. Right-click the icon in the notification area and click Exit. Repairing IIS Express while it's running won't show any error, but it will not fix the issue either. – Daniel Liuzzi Dec 05 '17 at 18:43
  • Installed the Creators Update somewhat late, on 2018-01-24 and this happened. It actually seems to have removed IIS Express. I would certainly call this a breaking change. Why is it still part of their release? – Patrick Borkowicz Jan 24 '18 at 15:24
  • Worked for me too! Thanks! – Jure Feb 18 '18 at 21:20
  • Classic "Programs and features" can be started by typing appwiz.cpl in start menu – SBF Feb 20 '18 at 10:31
37

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

tanveer ahmad dar
  • 3,312
  • 1
  • 27
  • 29
36

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.

Sikandar Amla
  • 1,415
  • 18
  • 27
  • 2
    This solution worked for me when I was blocked by a grayed out Modify button in Control Panel add/remove programs. – camelCase Nov 17 '17 at 14:30
  • 1
    you the man, microsoft f*cked up with its falls creator update sh*t, you fixed it. you worth more than the entire company – kexx Feb 09 '18 at 18:27
  • 1
    This fixed it for me - vanilla install of Visual Studio 2019 in Windows Server 2019. Didn't need a reboot. – user2728841 Oct 07 '19 at 18:40
12

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

Johan Bakar
  • 121
  • 1
  • 2
  • You don't have to install *all* of IIS - just tick the box and take the defaults. Making sure that's clear :) – Auri Rahimzadeh Jul 15 '17 at 17:41
  • Got the error with the Win10 Fall creators update, installing only the "Hostable Web Core" did the trick. Thanks ;) – LucasMetal Oct 18 '17 at 22:01
  • I can confirm also that following the Win10 Fall creators update, the above suggested solution of installing the Hostable Web core component did the trick. To do this click on the Microsoft Windows button, then type Turn Windows Features ON or OFF in the search box, then select Internet Information Services Hostable Web Core. – Jim Taliadoros Oct 29 '17 at 11:40
  • Best Solution. Worked for me like a charm. – vibs2006 Aug 12 '19 at 09:10
7

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.

Wesley
  • 251
  • 3
  • 9
3

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.

attila
  • 2,219
  • 1
  • 11
  • 15
1

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

Aymen Boumaiza
  • 1,339
  • 1
  • 9
  • 9
0

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.

Michael K
  • 822
  • 11
  • 13
0

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.

Don
  • 29
  • 1
0

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.

Illuminati
  • 4,539
  • 2
  • 35
  • 55
0
  • 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.

Ashish Dehariya
  • 216
  • 3
  • 10