同一个合约的两个绑定

发布于 2024-10-11 07:34:25 字数 303 浏览 3 评论 0原文

我有一份合同,其中有一个 basicHttpBinding。

            <endpoint address="http://localhost:49654/BookShopService.svc" binding="basicHttpBinding" contract="BookShop.IBookShopService">
            </endpoint>

我想使用 wsHttpBinding 添加另一个端点,以实现相同的绑定。 我必须采取哪些步骤?结果地址是什么?

I have a contract for which i have an basicHttpBinding.

            <endpoint address="http://localhost:49654/BookShopService.svc" binding="basicHttpBinding" contract="BookShop.IBookShopService">
            </endpoint>

I want to add another endpoint with wsHttpBinding, for the same binding.
What are the steps I have to take? What would be the resulting address?

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

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

发布评论

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

评论(2

厌倦 2024-10-18 07:34:25

只需添加另一个具有不同地址的终结点,它应该如下所示:

<endpoint address="http://localhost:49654/BookShopService.svc" binding="basicHttpBinding" contract="BookShop.IBookShopService">
</endpoint>
<endpoint address="http://localhost:49654/BookShopServiceWS" binding="wsHttpBinding" contract="BookShop.IBookShopService">
</endpoint>

MSDN

Just add another endpoint with a different address, it should look like this:

<endpoint address="http://localhost:49654/BookShopService.svc" binding="basicHttpBinding" contract="BookShop.IBookShopService">
</endpoint>
<endpoint address="http://localhost:49654/BookShopServiceWS" binding="wsHttpBinding" contract="BookShop.IBookShopService">
</endpoint>

There is a primer on MSDN.

妖妓 2024-10-18 07:34:25

如果您在 IIS 中运行,则不应提供完全限定的地址 - 该地址将由 IIS 确定,因此提供地址可能会导致部署问题。因此,以 Greg Sansom 的答案为基础,我建议

<endpoint address="" 
    binding="basicHttpBinding" 
    contract="BookShop.IBookShopService" /> 
<endpoint address="ws" 
    binding="wsHttpBinding" 
    contract="BookShop.IBookShopService" />

其中 ws 是服务位置的相对地址。

例如

If you are running in IIS, then you shouldn't supply a fully qualified address - the address will be determined by IIS and so supply one can cause deployment problems. So, using Greg Sansom's answer as a foundation, I'd suggest

<endpoint address="" 
    binding="basicHttpBinding" 
    contract="BookShop.IBookShopService" /> 
<endpoint address="ws" 
    binding="wsHttpBinding" 
    contract="BookShop.IBookShopService" />

where ws is a relative addresses to the service location.

e.g.

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