0

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 の問題は解決しました。ただし、上記のサービス メソッドの呼び出しは依然としてタイムアウトします。

4

1 に答える 1

0

実際のエラーメッセージなどの問題の説明が表示されないため、問題が何であるかを推測するのは困難です. これを管理者以外のアカウントで実行しようとしている可能性はありますか? 現在、Windows 7 の管理者以外のユーザー アカウントで IPC の形式として NetNamedPipeBinding を使用して WCF を取得する際に問題が発生しています。同じ問題が発生している可能性がありますか?

于 2011-04-29T02:27:52.397 に答える