简体   繁体   English

如何从 web.config 文件中的 xml 参数中检索值?

[英]How to retrieve value from xml parameter in web.config file?

I am new to C# ASP.Net and am following the following guide to do logging https://blog.tallan.com/2017/07/18/log-management-with-log4net-and-microsoft-azure/我是 C# ASP.Net 的新手,并且正在按照以下指南进行日志记录https://blog.tallan.com/2017/07/18/log-management-with-log4net-and-microsoft-azure/

I am unsure how to retrieve value from xml attribute using Configuration Manager.我不确定如何使用配置管理器从 xml 属性中检索值。 The following is my web.config file and I would like to retrieve the following value and assign to the string variable in my.cs file.以下是我的 web.config 文件,我想检索以下值并分配给 my.cs 文件中的字符串变量。 How do I go about it?我该怎么做 go 呢?

在此处输入图像描述

在此处输入图像描述

try this: ConfigurationManager.AppSettings[queueConnectionName]试试这个:ConfigurationManager.AppSettings[queueConnectionName]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM