记一次开发问题
代码读取程序所在路径同级目录下的一个xml文件,本地运行时是正常的,但是发布在服务器上一直运行失败,加了try/catch后发现报错:
[未能找到路径“C:\Windows\system32\xxx.xml”的一部分。]
后将代码做如下修改正常运行
//修改前
string path = Directory.GetCurrentDirectory();
//修改后
string path = AppDomain.CurrentDomain.BaseDirectory;
待后续研究确认~