I am trying to make my c++ ahadmin application compatible to IIS 7. My app needs to read the websites configuration (via metabase properties in IIS 6).
I read a lot of articles about the configuration paths and I think I have a good idea of how it work - however I am not sure of one thing:
To get to the configuration, I can either commit the MACHINE/WEBROOT/APPHOST/ path or the MACHINE/WEBROOT/APPHOST/Default Web Site.
I understand that the latter refers to the actual web.config of the specific website, and the former refers to the general applicationHost.config file, in which general settings are set.
My app doesn't know however whether a web.config file exists.
My question: if I want to get to this path - Object.ConfiguredObject.Site.Bindings, do I need to commit the APPHOST path or the APPHOST/Default Web Site path?
How do I know that in runtime?
You will always commit your bindings to
MACHINE/WEBROOT/APPHOST.You should go have a look at the schema files in:
They will help you identify where settings should belong.
Update:
Per your comment:
That all depends. IIS7 supports a mechanism called Feature Delegation. If a feature is delegated then this means a user can configure that feature in their local
web.config. Some features are configured undersystem.webServer, otherssystem.web.What a user can and can't configure locally in his/her
web.configis controlled by entries in two files:%systemrooot%\system32\inetsrv\config\administration.config%systemrooot%\system32\inetsrv\config\applicationHost.configIf you go and look at the IIS7 configuration schema in:
What you'll find is that there are two main types of section:
Anything that is configurable under
system.applicationHostis generally not considered a user modifiable configuration item. In fact if you openapplicationHost.configyou will see:Notice the
allowDefinition="AppHostOnly"? That's basically telling you that these settings can't be configured inweb.config.The scope of how feature delegation works is far too wide to cover in an answer so I suggest you read the article linked to above.