Getting the current directory in an assembly used by a web service app and windows service

前端 未结 1 1621
一向
一向 2021-01-21 07:19

I have an assembly that reads a configuration file which is in the application directory.

This assembly is used from a windows service and a web service.

From th

相关标签:
1条回答
  • 2021-01-21 07:50

    Why do you not just check if the config file exists in

    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "MyFile.config");

    and if it does not you check here:

    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin\MyFile.config");

    Hopefully I understood the description of the behaviour in the "webservice case" correctly.

    0 讨论(0)
提交回复
热议问题