我想获得一个 logFilePath 值,我通过硬编码提供给 appSettings。我试图通过
System.Configuration.Configuration rootWebConfig1 = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(null);
System.Configuration.KeyValueConfigurationElement customSetting = rootWebConfig1.AppSettings.Settings["azureLogUrl"];
string pathValue = customSetting.Value;
但我得到空引用异常。如何从 web.config 文件中获取值?