WCF多个Http/Https端点问题

本文关键字:端点 问题 Https 多个 Http WCF | 更新日期: 2023-09-27 17:59:43

可能重复:
WCF服务多端点配置

我有一个WCF服务:

https://myservice/service.svc
https://myservice/service.svc?wsdl

以下是我的WCF应用程序web.config的相关部分(如果您需要更多信息,请告诉我):

<bindings>
 <basicHttpBinding>
  <binding name="basicHttp">
  <security mode="TransportWithMessageCredential">
    <message clientCredentialType="UserName"/>
  </security>
  </binding>
 </basicHttpBinding>
</bindings>
<behaviors>
 <serviceBehaviors>
  <behavior name="MyService.ServiceBehavior">
  <serviceMetadata httpsGetEnabled="true"/>
  <serviceDebug includeExceptionDetailInFaults="true"/>
  <serviceCredentials>
    <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="SqlMembershipProvider"/>
  </serviceCredentials>
  <serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100"></serviceThrottling>
  </behavior>
 </serviceBehaviors>
</behaviors>
<services>
 <service behaviorConfiguration="MyService.ServiceBehavior" name="MyService.Service">
  <endpoint address="/ClientA" binding="basicHttpBinding" bindingConfiguration="basicHttp" name="basicHttpEndpoint" contract="MyService.IService"></endpoint>
  <endpoint address="/ClientB" binding="basicHttpBinding" bindingConfiguration="basicHttp" name="basicHttpEndpoint" contract="MyService.IService"></endpoint>
  <endpoint address="/ClientC" binding="basicHttpBinding" bindingConfiguration="basicHttp" name="basicHttpEndpoint" contract="MyService.IService"></endpoint>
  <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
 </service>
</services>

我希望我的客户能够通过以下链接访问服务,但这些链接不起作用:(或者可能我对以下链接的语法错误,如果是这样的话,请告诉我)

https://myservice/service.svc/ClientA
https://myservice/service.svc/ClientB
https://myservice/service.svc/ClientC

以下链接有效,但我不认为这是由于我的配置,就好像我在最后一个正斜杠之后写任何东西一样,它仍然有效。。。。

https://myservice/service.svc?wsdl/ClientA
https://myservice/service.svc?wsdl/ClientB
https://myservice/service.svc?wsdl/ClientC
https://myservice/service.svc?wsdl/asfgvafgfgf ... (this works too !!!)

请让我知道如何做到这一点。我不想为所有客户创建单独的服务。

WCF多个Http/Https端点问题

尝试去掉端点地址的'/'(就像mex端点地址一样)。地址采用相对路径。

在我的机器上的一个示例应用程序中,url看起来像。。。

http://localhost:56988/Service1.svc?ClientA