是否可以为同一服务上的不同合约返回不同的 wsdls?

发布于 2024-12-09 14:28:27 字数 121 浏览 1 评论 0原文

我有一个 WCF 服务,在两个不同的端点上实现两个合约。我希望客户端能够指向一个端点(而不是服务的基地址)并获取在该端点上实现的合同的 wsdl(而不是包含所有合同的 wsdl)。

这可能吗?如果可以,如何实现?

I have a WCF service implementing two contracts on two different endpoints. I would like a client to be able to point at an endpoint (rather than the base address of the service) and get the wsdl just for the contract implemented on that endpoint (rather than a wsdl containing all contracts).

Is this possible? If so, how can it be achieved?

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

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

发布评论

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

评论(1

胡渣熟男 2024-12-16 14:28:27

不要如下所示设置服务(如果托管在 IIS 中,则使用单个 SVC 文件)

<services>
    <service name="YourOrg.YourService">

        <endpoint address=""
                  binding="wsHttpBinding"
                  contract="YourOrg.IYourServiceThisContract" />
        <endpoint address="That"
                  binding="wsHttpBinding"
                  contract="YourOrg.IYourServiceThatContract" />
        <endpoint address="mex"
                  binding="mexHttpBinding"
                  contract="IMetadataExchange"/>
    </service>
</services>

将每个合同设置为单独的服务(在同一 IIS 网站中使用其自己的 SVC 文件)

<services>
    <service name="YourOrg.ThisService">

        <endpoint address=""
                  binding="wsHttpBinding"
                  contract="YourOrg.IYourServiceThisContract" />
        <endpoint address="mex"
                  binding="mexHttpBinding"
                  contract="IMetadataExchange"/>
    </service>

    <service name="YourOrg.ThatService">

        <endpoint address=""
                  binding="wsHttpBinding"
                  contract="YourOrg.IYourServiceThatContract" />
        <endpoint address="mex"
                  binding="mexHttpBinding"
                  contract="IMetadataExchange"/>
    </service>
</services>

Instead of setting up the service like shown below (with a single SVC file if hosting in IIS)

<services>
    <service name="YourOrg.YourService">

        <endpoint address=""
                  binding="wsHttpBinding"
                  contract="YourOrg.IYourServiceThisContract" />
        <endpoint address="That"
                  binding="wsHttpBinding"
                  contract="YourOrg.IYourServiceThatContract" />
        <endpoint address="mex"
                  binding="mexHttpBinding"
                  contract="IMetadataExchange"/>
    </service>
</services>

Set each contract as a separate service class (with its own SVC file in the same IIS website)

<services>
    <service name="YourOrg.ThisService">

        <endpoint address=""
                  binding="wsHttpBinding"
                  contract="YourOrg.IYourServiceThisContract" />
        <endpoint address="mex"
                  binding="mexHttpBinding"
                  contract="IMetadataExchange"/>
    </service>

    <service name="YourOrg.ThatService">

        <endpoint address=""
                  binding="wsHttpBinding"
                  contract="YourOrg.IYourServiceThatContract" />
        <endpoint address="mex"
                  binding="mexHttpBinding"
                  contract="IMetadataExchange"/>
    </service>
</services>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文