我有一個桌面應用程序,我需要測試我的Windows服務。獲取配置部分
應用程序只是調用處理我的業務的Windows服務類,首先它應該從app.config中加載一些數據。
應用程序配置是在服務項目中,我將我的混淆存儲在自定義節[ABCConfigurationSection]中。 像...
<ABCConfigurationSection>
<ConnectSettings>
<clear />
<add key="HostIp" value="10.0.X.X"/>
</ConnectSettings>
</ABCConfigurationSection>
主要配置部分是如..
<configuration>
<configSections>
<section name="ABCConfigurationSection" type="ABCConfiguration, App.Core" />
</configSections>
</configuration>
當我retrive傳遞「ABCConfigurationSection」作爲欄目名稱配置部分我得到空! 任何關於應用程序配置的結構是否缺失的想法
您可以顯示代碼,您是如何打電話的? – 2012-04-22 13:24:44
section = System.Configuration.ConfigurationManager.GetSection(「ABCConfigurationSection」)as App.Core.ABCConfiguration; – AshOoO 2012-04-22 13:35:34