WAS 托管的 WCF 服务中单个合约的多个端点?

发布于 2024-09-07 06:50:04 字数 293 浏览 3 评论 0原文

如果需要在异构环境中的 WAS 托管服务上为单个合约公开多个端点(例如,一个使用 basicHttpBinding,另一个使用 netTcpBinding),那么该如何做呢?

我读到的有关端点 WAS 配置的所有内容都表明端点地址和主机基址应留空,因为 WAS 应该通过 .svc 文件和协议的路径自动解析地址。

然而,在不解释地址的情况下,似乎不可能为同一个合约定义 HTTP 端点和 TCP 端点。到目前为止,我的每一次尝试都让我遇到了令人垂涎的“绑定实例已经关联到监听 uri”错误。

有想法吗?

谢谢

If one needs to expose multiple endpoints (e.g., one with basicHttpBinding, and another with netTcpBinding) for a single contract in a heterogeneous environment, on a WAS-hosted service, how does one do it?

Everything I've read about WAS configuration of endpoints indicates that endpoint addresses and host base addresses should be left blank, because WAS is supposed to automatically resolve addresses via the path to the .svc file and the protocol.

However, it seems impossible to define an HTTP endpoint and a TCP endpoint for the same contract without explicating the addresses. Every attempt of mine thus far has netted me the coveted "a binding instance has already been associated to listen uri" error.

Ideas?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

第七度阳光i 2024-09-14 06:50:04

看看这是否适合你
http://knowledgebaseworld.blogspot.com/ 2010/06/域名替换为机器名称.html
我遇到了同样的问题“绑定实例已经关联到监听 uri”,通过添加 httpGetUrl 和绑定地址来修复该问题

See if this works for you
http://knowledgebaseworld.blogspot.com/2010/06/domain-name-replaced-with-machine-name.html
I was hainvg same issue of "a binding instance has already been associated to listen uri" which get fixed by adding httpGetUrl along with binding address

寄意 2024-09-14 06:50:04

据我了解,*.svc 文件仅适用于 HTTP 协议,例如您可以将其用于您的 basicHttpBinding 连接。在这种情况下,您是绝对正确的 - 服务的基址和端点的地址属性将被忽略 - 服务 URI 由服务器名称、可选端口、SVC 文件所在的虚拟目录以及服务的名称和扩展名定义。 SVC 文件本身。

因此,只要您不需要多个不同的类似 HTTP 的协议和端点,一个 SVC 文件就应该处理 HTTP 流量。

但是,这些选项不适用于非 http 协议,例如 netTcpBinding。在这种情况下,您需要在 web.config 中定义一个端点地址(可能是适当基地址的相对路径)。

As far as I understand, the *.svc file is only viable for HTTP protocols, e.g. you can use it for your basicHttpBinding connection. In that case, you're absolutely right - the service's base address and the endpoint's address attribute are ignored - the service URI is defined by server name, optionally port, the virtual directory where the SVC file resides, and the name and extension of the SVC file itself.

So as long as you don't need multiple different HTTP-like protocols and endpoints, that one SVC file should take care of the HTTP traffic.

However, these options do not apply to non-http protocols, like netTcpBinding. In that case, you need to define an endpoint address (possibly as a relative path off an appropriate base address) in your web.config.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文