【发布时间】:2020-05-30 05:53:49
【问题描述】:
我正在使用.Net Core 中的新worker service 项目模板。从配置文件中读取凭据。 windows机器中的配置文件位置"D:/LC2/Files/Config.xml".
当我将worker service 运行为linux daemon 时,linux 将如何读取配置文件?因为只有windows 机器的路径可用,而不是linux。
这是我读取配置文件的代码
static List<intervalValue> GetConfig()
{
XmlDocument doc = new XmlDocument();
doc.Load("D:/LC2/Files/Config.xml");
XmlNode node = doc.DocumentElement.SelectSingleNode("/parameters/intervalValue");
{
for (int i = 0; i < node.ChildNodes.Count; i++)
{
IntervalTypeList.Add(new intervalValue { Name = node.ChildNodes[i].Attributes["Name"].Value);
}
}
return IntervalTypeList;
}
我该如何解决这个问题?
【问题讨论】:
标签: .net linux asp.net-core .net-core daemon