Now I have seen this question before on SO in a variant ways, but surprisingly not in this form:
I have a solution with multiple web services (projects) that need to
This actually drove me a bit crazy. In the end I fixed it like this:
bin
folder.SharedConfiguration
inside the common project. The really tricky part was having to use OpenMapped
ExeConfiguration() , and getting the path to the executable directory (including bin, and without file:// in front of it).SharedConfiguration.instance.AppSettings.Settings["CubilisEntryPointUrl"].Value
.(I cannot use SharedConfiguration.instance.AppSettings["CubilisEntryPointUrl"]
directly because of this issue)
.
public static class SharedConfiguration
{
public static readonly Configuration instance = GetConfiguration("Shared.config");
private static Configuration GetConfiguration(string configFileName)
{
ExeConfigurationFileMap exeConfigurationFileMap = new ExeConfigurationFileMap();
Uri uri = new Uri(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase));
exeConfigurationFileMap.ExeConfigFilename = Path.Combine(uri.LocalPath, configFileName);
return ConfigurationManager.OpenMappedExeConfiguration(exeConfigurationFileMap, ConfigurationUserLevel.None);
}
}