私はnetTCPエンドポイントを使用するWCFクライアントプロジェクトを持っています。プロジェクトは別のプロジェクトによって参照されるDLLにコンパイルされます。私はそうのように、ローカルとリモートのIPエンドポイントを切り替えることのAppSettingsを使用します。私は私のAppSettingsとWCFエンドポイントを持っているところApp.config AppSettings nullを返します
public EmbeddedClient()
{
//Grab ip to use: remote or local (used for simulator)
String location = ConfigurationSettings.AppSettings["ipAddress"];
String ip = ConfigurationSettings.AppSettings[location];
//Default to localhost if no appsetting was found
if (ip == null)
ip = "localhost";
String address = String.Format("net.tcp://{0}:9292/EmbeddedService", ip);
//Setup the channel to the service...
channelFactory = new ChannelFactory<IEmbeddedService>(binding, new EndpointAddress(address));
}
私のApp.configがある:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ipAddress" value="local"/>
<!-- Replace above value to "local" (Simulator) or "remote" (Harware)-->
<add key="local" value="localhost"/>
<add key="remote" value="192.168.100.42"/>
</appSettings>
<system.serviceModel>
<!--WCF Endpoints go here--->
</system.serviceModel>
</configuration>
私はいつもプロジェクトにのAppSettingをコンパイルするときnullを返します。私はまた、コンパイル後にapp.configがEmbedded_DCC_Client.dll.configのような名前に変更されていることに気付きました。なぜ私のappsettingsを見つけることができないのですか?なぜそれがnullを返すのですか?ありがとう。
あなたが関与(設定)ファイルを表示することはできますか。 –