[英]Finding custom .config file in azure function?
所以我有這個簡單的代碼來從本地工作的自定義配置中獲取 appsettings:
ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();
configFileMap.ExeConfigFilename = "My.config"; // This works locally but not on azure I think
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);
AppSettingsSection section = (AppSettingsSection)config.GetSection("appSettings");
var test = section.Settings["test"].Value; // throws nullref
現在,我在另一個項目中有“My.config”,並設置為“始終復制”以構建目錄,並且在使用 Azure-cli (localhost) 進行調試時它可以完美運行。 事實上,我認為這曾經在 Azure 中工作過,但現在不再適用了?
任何想法如何解決這一問題? 非常感謝!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.