Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created a WCF service with WsHttpBinding, with 2 binding configurations (this is the requirement for 2 different client). One client wanted the service to have Message security mode with clientCredential as "Windows" and the other client wanted the service to have Transport security mode with ClientCredentialType as Certificate. I am able to browse my Client2 service but unable to browse my client1. Here is my web.config with 2 bindings:

What I have tried:

<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>


Below are the settings I did in IIS:

1) Created a new website "TestService"

2) In Bindings: a) added https with port: 444 and selected the appropriate certificate b) added http with port: 90

3) In IIS TestService Feature View-->SSL Settings-->Require SSL (enabled), Accept and apply

4) Authentications-->Forms Authentication, Windows, Anonymous Enabled

Please suggest me what changes should I make to the config or IIS so that I have both the end points working...

Also, I named by endpoints as Client1 and Client2 assuming I should be able to browse them as
a) http://localhost:90/TestService.svc/Client1
b) https://localhost:444/TestService.svc/Client2

Currently, I am able to browse my service (client2) with
https://localhost:444/TestService.svc/

If I add Client2 at the end, it is not working. I am not sure if my endpoint address names are even working or not.

Thanks
Posted
Updated 29-Feb-16 14:51pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900