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>
「ABCConfigurationSection」をセクション名として渡して構成セクションを取得すると、null が発生しました。アプリ構成の構造に何かが欠けているかどうかについてのアイデア