21

When I tried to start my IIS server on my local machine (which is running on Windows 7), it is giving me an error saying:

value does not fall within the expected range

I have tried number of thing to correct this issue, but no success. then finally I re-installed the IIS server on my machine but issue is still persist.

Does anyone have any idea about this error? And how can I resolve it?

11 Answers 11

23

I have found that, this issue was coming due to incorrect virtual directory was created by visual studio in IIS due to which default web site was unable to start.

What I'd done to resolve this, I'd deleted my Default Web Site and created again in IIS. After that I'd created my application's specific virtual directories. This resolve my problem. Still not know why default web site stop working after incorrect virtual directory created by Visual Studio.

Hope this helps for those who are facing this issue.

4
  • I know this has been a while but what is an incorrect virtual directory? What was wrong with it?
    – Speck
    Dec 4, 2015 at 22:15
  • In my case virtual directory was created from Visual Studio was causing issue and I had to create the virtual directory manually in IIS server. Please let me know if this will resolve your issue or not. Dec 10, 2015 at 7:21
  • I wound up doing the same thing. I can't remember if this was the final solution or not though.
    – Speck
    Dec 10, 2015 at 12:40
  • @Speck To go into more detail in case anyone else runs into this issue I specifically had a duplicate entry where I had inserted http:// into the application path. So it looked like this <application path="/localhost/mypath" ... (everything else the same) <application path="/mypath" .... Feb 7, 2018 at 19:30
14

I had this issue in IIS 8.5, the problem ended up being an incomplete entry for the host name in the bindings. I didn't include .com on the FQDN.

2
  • That happened to me with an incomplete domain like .domain.com (inserted by error via powershell)
    – Teejay
    Sep 6, 2022 at 9:00
  • For me, it was a wildcard binding (*.domain.com) on an older version of IIS, inserted by powershell.
    – kevinpo
    Jan 3 at 16:04
9

I have this issue with setting specific accounts for the site to run as..

It goes away if you set the password in the applicationHost.config directly. Cannot do it though IIS anymore though..

In: C:\Windows\System32\inetsrv\config

May help.

2
  • +1 for me - Running IIS8.5 on 2012 this was the only solution I could find despite perform having the Test Settings pass via the UI
    – timkly
    Aug 24, 2016 at 6:38
  • Thank you! I was able to find the "bad" virtual directory in applicationHost.config. This is a much better solution than deleting the Default Web Site and recreating every single virtual directory Sep 25, 2019 at 19:59
9

I was experiencing the same problem. And the problem was with the file pointed out by @aaron-gibson.

applicationHost.config at: C:\Windows\System32\inetsrv\config

(see here: IIS Configuration Reference)

One of the site had incorrect data:

<application path="/e:\MyFolder\MySiteWithProblem\VDir" applicationPool="AppPool152">
<virtualDirectory path="/" physicalPath="e:\MyFolder\MySiteWithProblem\VDir\Vdir" />

The application path in this case had invalid characters. And also, the physicalPath didn't exist.

Fixing this entry fixed the problem.

The answer marked as the solution fixed the problem because it recreated this file from scratch. But in my case I did not lose all my sites.

I changed the file applicationHost.config at: C:\Windows\System32\inetsrv\config

And the entries for each site are in the tags:

<configuration> <system.applicationHost> <sites> ... <site name="Default Web Site" id="1" serverAutoStart="true"> <application path="/MyPath" applicationPool="AppPool152"> <virtualDirectory path="/" physicalPath="e:\MyFolder\MySite\Vdir" /> </application> ... <site> ... </sites> </system.applicationHost> </configuration>

4
  • To go into more detail in case anyone else runs into this issue I specifically had a duplicate entry where I had inserted http:// into the application path. So it looked like this <application path="/localhost/mypath"; ... (everything else the same) <application path="/mypath" I marked this as the correct answer however I would hope the writer @mastro could leave a little more detail (image?) of where he removed the entry from. Feb 7, 2018 at 19:33
  • I changed the file applicationHost.config at: C:\Windows\System32\inetsrv\config And the entries for each site are in the tags:
    – mastro
    Feb 15, 2018 at 20:34
  • This problem drove me insane. I tried everything, but what solved it was when I found and deleted bad virtual directory from applicationHost.Config Mar 26, 2020 at 18:35
  • upvoting this because it provides information for actually discovering the error and fixing it, rather than the otherwise perfectly acceptable but not as complete solution of deleting everything and starting again. May 2, 2020 at 4:52
6

I had this issue with a new IIS 10 deployment. Our network team copied over the applicationhost.config file from the older servers and this caused it. In IIS 10 there are two new settings that encrypt the password for the app pool identity. Since the IIS 7 config file didn't have those encryption settings then IIS threw this error when assigning a new user. I simply copied over the settings from a brand new server build and it started working fine. Add these two settings to the existing ones already there:

<configProtectedData>
    <providers>

        <add name="IISCngProvider" type="Microsoft.ApplicationHost.CngProtectedConfigurationProvider" description="Uses Win32 Crypto CNG to encrypt and decrypt" keyContainerName="iisCngConfigurationKey" useMachineContainer="true" />
        <add name="IISWASOnlyCngProvider" type="Microsoft.ApplicationHost.CngProtectedConfigurationProvider" description="(WAS Only) Uses Win32 Crypto CNG to encrypt and decrypt" keyContainerName="iisCngWasKey" useMachineContainer="true" />

    </providers>
</configProtectedData>
4

Mine turned out to be an issue with the binding. I deleted than used another name in the binding and it worked great.

Good luck!

2
  • Same here, our binding contained an unreplaced octopus variable so something like mywebsite#{environment}.domain.com Nov 2, 2018 at 15:13
  • Likewise here, Eventviewer (under System) showed that there was an invalid character in the binding. Turned out there was an extra space at the end of the string.
    – Tom Wuyts
    Oct 27, 2020 at 13:38
4

I've had this issue and the problem was that the binding was wrong, there was a "space" after the url.

Check your bindings for any wrong characters and if there's anything else wrong with it.

0
3

I've had this issue with Octopus Deploy.

It turned out the issue was with the binding where it had an extra space at the end of the hostname when setting up the project in Octopus.

You can also see this from the applicationhost.config in C:\Windows\System32\inetsrv\Config

2

This message can be caused by a malformed application name in the applicationHost.config file in C:\Windows\System32\inetsrv\config.

For example, I had a "\" in an application name which, once removed, eliminated the error.

1

This problem can be caused by setting the "Host name" to a number. The "Host name" needs to contain at least 1 letter.

2
  • 1
    By "at least 1 character", do you mean "at least 1 letter"?
    – MEMark
    Mar 16, 2018 at 21:14
  • This was sorta my issue -- someone put a path in the hostname
    – Mike
    Jul 5, 2018 at 12:00
0

I've had this error message before when I was using an automated build and deployment system (TeamCity with Octopus deploy). It turned out that the port number I'd specified for IIS in the Octopus Deploy variables was too high.

From what I could find on this web site the highest port number IIS will accept is 65535.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.