有沒有辦法在app.config文件中寫入有關端點的信息? 其實我想讀取一個app.config文件中的<service>
標記,並且希望將它寫入其他app.config文件的<Services>
標記中。如何在運行時WCF的app.config中編寫端點信息?
請別人告訴我該怎麼辦?
其實我有所謂的「WCFService.exe.config」,我想在我的程序來讀取配置文件,所以我正在寫的是:
string path = Path.Combine(Application.StartupPath, "WCFService.exe.config");
Configuration config = ConfigurationManager.OpenExeConfiguration(path)
ServicesSection serviceSection = ConfigurationManager.GetSection("system.serviceModel/services") as ServicesSection;
ServiceElementCollection sereleColl = serviceSection.Services;
,但我什麼也沒有在sereleColl。
實際上我不想讀取當前可執行文件的app.config,但我想讀取另一個「WCFService.exe.config」的app.config文件。 – 2009-07-10 09:50:46
我仍然可以使用你的方法加載其他配置。 – Ezombort 2009-07-10 10:02:18
我唯一的想法是,你的配置文件中一定有錯誤,但我想你已經檢查過了.-) – Ezombort 2009-07-10 10:05:15