I'm having trouble figuring out how to get a named pipe WCF service to work. The service is in a seperate assembly from the executable.
The config looks like this:
<system.serviceModel>
<bindings>
<netNamedPipeBinding>
<binding name="NoSecurityIPC">
<security mode="None" />
</binding>
</netNamedPipeBinding>
</bindings>
<client>
<endpoint name="internal"
address="net.pipe://localhost/"
binding="netNamedPipeBinding"
bindingConfiguration="NoSecurityIPC"
contract="TimeService.ITimeService" />
</client>
<services>
<service name="TimeService">
<host>
<baseAddresses>
<add baseAddress="net.pipe://localhost/" />
</baseAddresses>
</host>
<endpoint name="internal"
address="net.pipe://localhost/"
binding="netNamedPipeBinding"
bindingConfiguration="NoSecurityIPC"
contract="TimeService.ITimeService" />
</service>
</services>
</system.serviceModel>
I'm using a ChannelFactory to create a proxy to access the service host:
ServiceHost h = new ServiceHost(typeof(TimeService), new Uri("net.pipe://localhost/"));
h.AddServiceEndpoint(typeof(ITimeService), new NetNamedPipeBinding("NoSecurityIPC"), "");
h.Open();
ChannelFactory<ITimeService> factory = new ChannelFactory<ITimeService>("internal");
ICpTimeService proxy = factory.CreateChannel();
using (proxy as IDisposable)
{
this.ds = proxy.LoadData();
}
ChannelFactory を作成するときに何が間違っているのかわかりません。設定で「channel1」が見つからないようです。バインディングを手動で作成して ChannelFactory コンストラクターに渡すと、ファクトリとプロキシは作成されますが、LoadData() の呼び出しは失敗します (タイムアウト)。
ここで私が間違っていることを誰かが見ることができますか?
編集: 上記の app.config を編集して、両方のエンドポイントがまったく同じデータを持つようにしました。これで Channelfactory の問題は解決しました。ただし、上記のサービス メソッドの呼び出しは依然としてタイムアウトします。