We are getting an error when we try to read the connection string in the config file. This is how I read the config file:
ConfigurationManager.ConnectionStrings[connectionStringName];
Below is the Error. The virtual path '/site1' maps to another application, which is not allowed.
Finally, this is my site structure in IIS server. Please note that the three sub websites are hosted under the main Web site.
Note: This error is not always occurring. Sometimes all the websites work fine without any issues. Also, the three sub websites refer to the same code base.
Below is the complete trace log:
The following exception was thrown: The virtual path '/site1' maps to another application, which is not allowed.. Exception details: System.ArgumentException: The virtual path '/site1' maps to another application, which is not allowed.
at System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp)
at System.Web.HttpContext.GetFilePathData()
at System.Web.HttpContext.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.get_ConnectionStrings()
I seem to have this issue in the following place as well:
The following exception was thrown: The virtual path '/site1' maps to another application, which is not allowed.. Exception details: System.ArgumentException: The virtual path '/site1' maps to another application, which is not allowed.
at System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp)
at System.Web.HttpContext.GetFilePathData()
at System.Web.HttpContext.GetSection(String sectionName)
at System.ServiceModel.Activation.HostedAspNetEnvironment.UnsafeGetSectionFromWebConfigurationManager(String sectionPath, String virtualPath)
at System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetSectionNoTrace(String sectionPath)
at System.ServiceModel.Diagnostics.TraceUtility.SetEtwProviderId()
at System.ServiceModel.ChannelFactory..ctor()
at System.ServiceModel.ChannelFactory`1..ctor(Type channelType)
at System.ServiceModel.ChannelFactory`1..ctor(Binding binding, EndpointAddress remoteAddress)
at System.ServiceModel.ClientBase`1..ctor(Binding binding, EndpointAddress remoteAddress)
This seems to occur when the system tries to read the web service settings.