AppSettings in App or Web Config Using a Linked File

前端 未结 3 1398
独厮守ぢ
独厮守ぢ 2021-01-11 11:48

I\'m trying to reference some common config settings between a Windows Service and an ASP.NET MVC website. I am doing this by using the file attribute on appSettings in eit

3条回答
  •  一整个雨季
    2021-01-11 11:55

    I use this to access another .exe's config file, not sure whether it will work with a MVC project, but this might get you closer:

    string proj2Exe = @"C:\projects\proj2\bin\Debug\proj2.exe";
    Configuration proj2Config = ConfigurationManager.OpenExeConfiguration(proj2Exe);
    string mysetting = proj2Config .AppSettings.Settings["ThatSetting"].Value;
    

提交回复
热议问题