English 中文(简体)
WCF 客户使用多种服务
原标题:WCF Client consuming multiple services

我试图说明如何建立我的网络。

我有两个终点,我认为我需要两个不同的具有约束力的组合。 这是我目前具有约束力的决定:

<basicHttpBinding>
    <binding name="WebServiceProxyServiceSoapBinding" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00"
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="Transport">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>

我可以补充另一个基本的HttpBled node。 如果我改动的是<代码><security model=“Transport”>中的所有参数,那么,该约束力对于一个或另一个终点会有很大作用。

这似乎是一个共同的问题,但没有找到答案。 总的说来,在单纯的消费和需求之外,我对世界合作框架(如果这不很明显)没有太多的经验。 任何帮助都将是全球教育倡议。

This article was close but not quite the same issue as they did not need a different security mode.: How to consume multiple WCF services from one client

提前感谢。

最佳回答

仅需要添加另一个<代码>< binding> node,在<basicHttpBled> node下,有不同的名称和你喜欢的不同选择。

那么,显然,仅仅确保每个客户都配置起来,以使用其特有的约束性,在<约束性编码>约束性组合/代码>中为每个用户设定适当的名称:<代码><endpoint> node。

问题回答

I have the two endpoint, I guess I need two different Binding configurations. This is my current binding node:

不一定——如果这两个部门使用相同的环境和相同的议定书,一个具有约束力的组合将这样做。

你们需要增加两项内容:

<system.serviceModel>
   <bindings>
       ..... (as you already have it) ....
   </bindings>
   <client>
      <endpoint name="Service1Endpoint"
                address="http://yourserver/service1.svc" 
                binding="basicHttpBinding"
                bindingConfiguration="WebServiceProxyServiceSoapBinding"
                contract="IWCFService1"  />
      <endpoint name="Service2Endpoint"
                address="http://yourserver/service2.svc" 
                binding="basicHttpBinding"
                bindingConfiguration="WebServiceProxyServiceSoapBinding"
                contract="IWCFService2"  />
   </client>
</system.serviceModel>

这应当做到。

当然,如果你的第二个服务使用另一个约束性或需要不同的安全环境,那么是,你需要增加第二个<代码><约束力名称=“其他”......。 参见:<basicHttpBled> node and reference that second binding composition from one of the You two/67/ endpoints here。





相关问题
WCF DataMember Serializing questions

Ok, so I was part way through the long winded process of creating DTOs for sending my model over the wire and I don t feel like I m going down the right route. My issue is that most of the entities ...

Access WCF service on same server

I have a .NET website with a WCF service. How do I access the current operations context of my service? One possible work around is to just make a call to the service within the app...but that seems ...

WCF binding error

So I got into work early today and got the latest from source control. When I try to launch our ASP.NET application, I get this exception: "The binding at system.serviceModel/bindings/wsHttpBinding ...

The service operation requires a transaction to be flowed

I am facing strange issue with our WCF service. The same code was working fine until recently we added more OperationContracts(Web Methods). We have common 3 tier architecture. DAL (WCF) BLL Web ...

热门标签