Quantcast
Channel: Configuration & Scripting
Viewing all articles
Browse latest Browse all 780

Unable to get connection string sub-sites under default website or any other parent site.

$
0
0

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


Viewing all articles
Browse latest Browse all 780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>