通过命名管道绑定公开 WCF 服务 [英] Expose a WCF Service through a Named Pipes binding

查看:31
本文介绍了通过命名管道绑定公开 WCF 服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天前我成功地实现了一个托管在 Windows 服务中的 WCF 服务.StackOverflow 的社区帮助我解决了 这里的 WSDL 暴露.我再次感谢你.然而,最近我发现这个服务的另一个潜在客户端与服务位于同一台机器上,这让我认为我应该添加另一个具有 namedPipesBinding 的端点.

I successfully implemented a WCF Service hosted in a Windows Service a few days ago. The community here at StackOverflow helped me with the WSDL exposure here. I thank you once again. However recently I found out that there is another potential client for this service this time located on the same machine as the service and this lead me to think I should add another endpoint with the namedPipesBinding.

就我而言,命名管道似乎是机器内通信的最佳解决方案.如果有误,请纠正我.

Named pipes seem to be the best solution for intra-machine communication as far as I am concerned. Please correct me if this is wrong.

我需要为同一个服务/合同公开另一个端点,但这次使用的是 netNamedPipeBinding.但是,我真的不明白如何从客户端添加服务引用.添加

I need to expose another endpoint for the same service/contract but this time using a netNamedPipeBinding. However I really don't understand how do I can then add a service reference from a client. Foolishly after adding

<endpoint address="net.pipe://localhost/OfficeService"
          binding="netNamedPipeBinding"
          contract="netBridge.Development.OfficeService.IWordService"
          bindingConfiguration="localBinding" />

我尝试在位于同一台机器上的 Windows 窗体应用程序中添加服务引用,并输入 net.pipe://.... url.它没有用.我必须提到我之前已经删除了 mex(元数据交换)端点,因为我认为没有必要.

I have tried to add a service reference in a Windows Forms Application located on the same machine typing the net.pipe://.... url. It didn't work. I must mention I have removed the mex (MetaData Exchange) endpoint earlier because I considered it not necessary.

  1. 命名管道端点绑定发现需要此 mex 端点吗?
  2. 我应该如何将客户端应用中的服务引用添加到命名管道端点?

推荐答案

您的端点看起来不错,虽然我对 localBinding 中的内容感到好奇...

Your endpoint looks fine, although I'm curious about what's in localBinding...

听起来最简单的选择是更改命名管道客户端上的端点配置以匹配您的服务端点.只要客户端是客户端配置文件中的唯一端点,客户端就不应该关心它.否则,您必须向端点添加名称,并让客户端在您新建代理对象时选择一个特定的名称.

Sounds like the easiest option is to just change the endpoint configuration on the named pipes client to match your service endpoint. The client shouldn't care as long as it's the only endpoint in the clients config file. Otherwise you'll have to add names to your endpoints and have the client pick a specific one when you new-up the proxy object.

祝你好运!

这篇关于通过命名管道绑定公开 WCF 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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