2016-02-27 102 views
0

我使用WsHttpBinding创建了一个带有2个绑定配置的WCF服务(这是针对2个不同客户端的要求)。一个客户希望该服务具有clientCredential的消息安全模式为“Windows”,另一个客户希望该服务具有ClientCredentialType作为“证书”的传输安全模式。我可以浏览我的Client2服务,但无法浏览我的客户端1。 这里是我的web.config 2个绑定:使用具有不同绑定配置的两个端点配置WCF服务

<system.serviceModel> 
    <services> 
     <service name="TestService.TestService" behaviorConfiguration="mexBehavior"> 
     <endpoint address="Client1" binding="wsHttpBinding" contract="TestService.ITestService" bindingConfiguration="TestService_Client1_ITestService" > 
     <identity> 
      <dns value="" /> 
      </identity> 
     </endpoint>  
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>   
     <endpoint address="Client2" binding="wsHttpBinding" contract="TestService.ITestService" bindingConfiguration="TestService_Client2_ITestService" />        
     </service>      
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="mexBehavior">   
      <useRequestHeadersForMetadataAddress /> 
      <serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" />        
     </behavior> 
     </serviceBehaviors>   
    </behaviors> 
    <bindings> 
     <wsHttpBinding>     
     <binding name="TestService_Client1_ITestService">   
      <security mode="Message"> 
       <transport clientCredentialType="Windows" proxyCredentialType="None" 
       realm="" /> 
       <message clientCredentialType="Windows" negotiateServiceCredential="true" 
       algorithmSuite="Default" /> 
      </security> 
     </binding> 

     <binding name="TestService_Client2_ITestService">    
      <security mode="Transport"> 
        <!--<transport clientCredentialType="None" />--> 
        <transport clientCredentialType="Certificate" /> 
      </security>   
     </binding>   
    </wsHttpBinding> 
</bindings> 

下面是我在IIS中做了设置:

1)创建一个新的网站 “TestService的”

2)在绑定: a)添加https与端口:444并选择适当的证书 b)在端口添加http:90

3)在IIS TestService功能视图 - > SSL设置 - >需要SSL(启用),接受并应用

4)认证 - >表单验证,Windows,匿名启用

请给我建议,我应该做出什么样的变化对配置或IIS使我有两个端点的工作...

另外,我的终点命名为客户端1和客户端2假设我应该能够浏览他们作为
一)http://localhost:90/TestService.svc/Client1
b)https://localhost:444/TestService.svc/Client2

目前,我能够浏览我的服务(客户端2)与
https://localhost:444/TestService.svc/

如果我在最后添加Client2,它不起作用。我不确定我的端点地址名是否正常工作。

感谢

+0

我仍然坚持这个问题,有人可以请我建议我需要做的配置更改/ IIS更改吗? – marak

回答

0

做一些研究之后,我得到了两个端点的工作。在IIS的步骤,

3)在IIS TestService的功能视图 - > SSL设置 - >取消选中需要SSL(UnCheck this),但选中(接受)和选择应用

这对我来说是诀窍,我能够得到它的两个终点的工作。

而且,在我的问题我有幸能够浏览这两个端点一个误区:
一)http://localhost:90/TestService.svc/Client1
B)https://localhost:444/TestService.svc/Client2

在现实中,我们将不能够浏览,这个符号是在创建客户端时很有用,它可以通过端点名称或基于端点配置实例化