更新时间:2023-02-06 12:52:39
您是否确保将配置文件正确放置在运行应用程序的目录中?该目录中实际上有一个名为< app name> .exe.config的文件吗?
Did you ensure that the config file is placed correctly at the directory from which you're running the application? Is there actually a file called <app name>.exe.config in that directory?
我只是在这里猜测-也许您在其中添加了App.Config文件
I'm just guessing here - maybe you added the App.Config file in a different project then your exe assembly project...?
顺便说一句,我将您的代码和App.Config照原样复制到一个干净的项目中,并且此代码有效为了我。因此,我只看配置文件本身的方向,而不看代码。代码很好...
By the way, I copied your code and App.Config as is to a clean project, and this code worked for me. So I'd look in the direction of the config file itself and not in the code. The code is fine...
希望这会有所帮助,
Ran