![](/img/trans.png)
[英]Read and replace Values of a particular tag in web.config stored at a different project locations in C#
[英]How to read web.config of different project?
在我的解決方案中,我有兩個項目-1。 WCF服務,2.類庫。 WCF服務具有類庫的項目引用。 我想在我的類庫中閱讀web.config的configurationsection。 那怎么可能?
注意注意,不知道WCF服務的發布位置。
您需要在references文件夾中添加對System.Configuration
的引用。 你絕對應該使用ConfigurationManager
在過時的ConfigurationSettings.
如果您只想讀取應用程序密鑰 ,可以嘗試,
<appSettings configSource="fie_path_of_another_project">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.