I\'m trying to finish this exception handler:
if (ConfigurationManager.ConnectionStrings[\"ConnectionString\"]==null)
{
string pathOfActiveConfigFile = .
Try this
AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
I tried one of the previous answers in a web app (actually an Azure web role running locally) and it didn't quite work. However, this similar approach did work:
var map = new ExeConfigurationFileMap { ExeConfigFilename = "MyComponent.dll.config" };
var path = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None).FilePath;
The config file turned out to be in C:\Program Files\IIS Express\MyComponent.dll.config. Interesting place for it.