An exception is thrown when attempting to open the web configuration for a web application on a non default website.
System.InvalidOperationException: Failed to resolve the site ID for 'SubSite'
Steps to reproduce
1. add new application or virtual directory under any parent site in IIS.
2. Try opening the web.config for that web application ( ParentSite/mySite/web.config) using the following code (from a separate application)
WebConfigurationManager.OpenWebConfiguration("/mySite", "NonDefaultWebSite", null, Environment.MachineName);
This works on IIS 6 and for default websites on IIS 8.
as per this link
http://forums.iis.net/t/1149029.aspx?Unable+to+open+web+configuration+on+non+default+websites
this cant be possible. but is there any alternate to do it other thenOpenWebConfiguration.
Thanks,
ajayK