[英]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.