IIS7: Possible causes of ‘Unrecognized configuration path’ error

configuration-filesiis-7

After setting up an ASP.NET website in IIS7 I get an Internal Server Error (500.19) that says:
'Unrecognized configuration path'.

What are possible causes of this error?

(Setting up other ASP.NET websites works OK, but for a particular website it does not work and I cannot figure out the difference.)


Detailed error description:

Error Summary:
HTTP Error 500.19 – Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module: IIS Web Core
Notification: BeginRequest
Handler: Not yet determined
Error Code: 0x80070002
Config Error: Unrecognized configuration path 'MACHINE/WEBROOT/APPHOST/…'
Config File:
Requested URL: http://…:80/
Physical Path:
Logon Method: Not yet determined
Logon User: Not yet determined
Config Source:
-1:
0:

Best Answer

I found I'd gotten this same error after making a few changes to the site configuration of my applicationhost.config file. After looking more closely and comparing some sites which were working correctly against other sites which weren't working correctly, I noticed that I had apparently whacked the parent application configuration for a few of my sites.

Here's an example of the site configuration when I was getting the "Unrecognized configuration path" 500.19 error:

<site name="Peanuts-Site" id="2345">
    <application path="/peanuts" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\websites\Peanuts" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:80:localhost" />
    </bindings>
</site>

And here's what it looked like after I restored the deleted parent application:

<site name="Peanuts-Site" id="2345">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Users\firstname.lastname\Documents\My Web Sites\Peanuts-Site" />
    </application>
    <application path="/peanuts" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\websites\Peanuts" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:80:localhost" />
    </bindings>
</site>

Unbeknownst to me at the time, IIS Express seems to require a an application to be defined that's mapped to the site root when specifying any application not mapped to the site root. And on second thought, this requirement actually does make sense after all.

Lesson learned -- Don't go on an overzealous pruning spree unless you know what you're doing. I'm just glad I remembered what I did so I could fix it later.