错误如下

今天做window 服务遇到个问题。

找了N多原因都未能解决。

突然想起事件查看器。

发现有句错误。

无法启动服务。System.IO.FileNotFoundException: 未能找到文件“C:\Windows\system32\Config.xml”。

问题原因终于找到了。原来是路径问题,启动为服务后默认的运行目录是system32

因此解决方法如下

AppDomain.CurrentDomain.BaseDirectory

加入这一句话问题就解决了

相关文章:

  • 2021-08-21
  • 2021-09-04
  • 2021-10-22
  • 2021-07-14
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-15
  • 2022-03-07
  • 2022-03-02
  • 2021-08-11
  • 2022-01-28
  • 2021-07-20
相关资源
相似解决方案