【问题标题】:WCF Multiple Http/Https Endpoints problem [duplicate]WCF 多个 Http/Https 端点问题 [重复]
【发布时间】:2011-09-19 16:58:02
【问题描述】:

可能重复:
WCF Service multiple endpoint configuration

我有 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 !!!)

请告诉我如何实现这一点。我不想为所有客户创建单独的服务。

【问题讨论】:

  • 对不起,但我真的坚持这个,我需要一些答案,我的主题问题在问题的海洋中得到了回答,所以再问一次,如果你可以删除最后一个(或者如果你可以告诉我怎么做)..我很乐意删除那个..但是请让它活着......我需要一些出路......

标签: c# asp.net wcf iis


【解决方案1】:

尝试从端点地址中去掉“/”(就像 mex 端点地址一样)。地址假定为相对路径。

在我的机器上的示例应用程序中,网址看起来像......

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

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2011-02-04
  • 1970-01-01
  • 2013-09-30
  • 2011-04-18
  • 2013-10-02
  • 1970-01-01
  • 2021-12-13
  • 2012-12-02
相关资源
最近更新 更多