小编ibu*_*rak的帖子

如何从MVC4中的web.config获取String值

我想获得一个logFilePath值,我将硬编码提供给appSettings.我试图达到关键价值

System.Configuration.Configuration rootWebConfig1 = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(null);
System.Configuration.KeyValueConfigurationElement customSetting = rootWebConfig1.AppSettings.Settings["azureLogUrl"];
string pathValue =  customSetting.Value;
Run Code Online (Sandbox Code Playgroud)

但我得到null引用异常.如何从web.config文件中获取值?

c# asp.net-mvc azure asp.net-mvc-4

16
推荐指数
2
解决办法
5万
查看次数

标签 统计

asp.net-mvc ×1

asp.net-mvc-4 ×1

azure ×1

c# ×1