WCF HTTP和NamedPipe服务 [英] WCF HTTP and NamedPipe service

查看:153
本文介绍了WCF HTTP和NamedPipe服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建一个WCF服务,在此刻,揭露了一些使用basicHttpBinding的合同。不过,我现在想在本地使用的服务在同一台机器上,并且netNamedPipeBinding似乎更适合在性能方面。出于这个原因,我想用一个命名管道和HTTP以暴露服务

I'm creating a WCF service which, at the moment, exposing a number of contracts using a basicHttpBinding. However, I now want to use the service locally on the same machine, and a netNamedPipeBinding seems more appropriate in terms of performance. For that reason, I want to expose the service using a named pipe and HTTP.

目前,我这样做,配置如下:

At the moment I'm doing this with the following configuration:

<service name="WCFService.MyService" behaviorConfiguration="serviceBehaviour">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8080/MyService" />
        <add baseAddress="net.pipe://localhost/MyService" />
      </baseAddresses>
    </host>

    <endpoint address="calculator" binding="basicHttpBinding" contract="WCFService.ICalculatorService" />
    <endpoint address="database" binding="basicHttpBinding" contract="WCFService.IDatabaseService" />
</service>

这似乎做工精细,但仔细观察的终点仍然使用basicHttpBinding的。这工作,但我得到了IM pression它造成了不必要的开销。

This appears to work fine, but on closer inspection the endpoints are still using the basicHttpBinding. This works, but I get the impression it's creating unnecessary overhead.

我是否需要为每个合同的端点,而每个绑定类型(即basicHttpBinding的和netNamedPipeBinding),或者我要对这个完全错误的?

Do I need to create an endpoint for each contract, and each binding type (i.e. basicHttpBinding and netNamedPipeBinding) or am I going about this completely wrong?

(如果它是不明确的,我是相当新的WCF!)

(If it's not clear, I'm fairly new to WCF!)

推荐答案

是的,你需要指定多个端点(每个结合1端点):

Yes, you need to specify multiple endpoints (1 endpoint per binding):

<endpoint address="calculator" binding="basicHttpBinding" contract="WCFService.ICalculatorService" />
<endpoint address="database" binding="basicHttpBinding" contract="WCFService.IDatabaseService" />

<endpoint address="calculator" binding="netNamedPipeBinding" contract="WCFService.ICalculatorService" />
<endpoint address="database" binding="netNamedPipeBinding" contract="WCFService.IDatabaseService" />

这篇关于WCF HTTP和NamedPipe服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆