且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Web服务中引用dll配置文件时加载dll配置文件的问题

更新时间:2022-12-05 22:57:05

当你尝试使用.Net中的ConfigurationManager类从dll访问配置文件时实际上会引用dll托管地点的配置文件,在这种情况下你的web.config。



是的,对于dll,我建议你自己拥有用于读取xml文件的代码,并使用dll部署xml文件。另一种方法是将dll所需的设置添加到web.config。
When you try to access config files using the ConfigurationManager class in .Net from a dll it will actually reference the config file of wherever the dll is being hosted, in this case your web.config.

Yes, for dlls, I would recommend just having your own code for reading xml files and deploy the xml file with the dll. The alternative is to add the settings that the dll need into your web.config.