We have a parent website and have separate virtual directories under it. The parent website points to a ASP.NET web app and all the virtual directories point to a common ASP.NET web app. The parent website an the virtual directory share one common app pool.
The code in the virtual directories access the web.config of the parent website. However, intermittently one virtual directory cant find the web.config of the parent website throwing error. This intermittent issue happens for one virtual directory at random but at the same time doesn't happen with others. I compared the metabase configuration file for virtual directories and they are same. The only workaround for this to recycle the app pool which would affect the virtual directories having no issues. Could somebody have any idea on why the virtual directory cant access web.config of the main website?
string MembershipProvierName = (WebConfigurationManager.GetSection(MembershipSectionKey) as MembershipSection).DefaultProvider;
Error (when It tries to get a section from the web.config )
Stack Trace :
at System.Web.CachedPathData.GetPhysicalPath(VirtualPath virtualPath) at System.Web.CachedPathData.GetConfigPathData(String configPath) at System.Web.HttpContext.GetFilePathData() at System.Web.HttpContext.GetSection(String sectionName)