none
WCF SOAP Service with custom authentication

    Question

  • Hi Guys,

    I have created a web service using WCF with wsHttpBinding. I have deployed the service with self-signed certificate on443 port and I am using authenticating the service using client credentials. While consuming the service, I am getting the below error.

    Inner Exception:The request for security token could not be satisfied because authentication failed.

    Error:The caller was not authenticated by the service.

    Below is my service model code in web.config.

    <system.serviceModel>
            <services>
                <service name="My Service Name">
                    <endpoint address="" binding="wsHttpBinding" bindingName="Binding1" contract="IContract">
                    <identity>
                   <userPrincipalName value="host server name" />                     
               </identity>
               
               </endpoint>

                    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
                    <host>
                        <baseAddresses>
                            <add baseAddress="host address"/>
                        </baseAddresses>
                    </host>
                </service>
            </services>
            <bindings>
                <wsHttpBinding>
                    <binding name="Binding1">
              <security mode="Message">
              <message clientCredentialType="UserName" />
                        </security>
                    </binding>
                </wsHttpBinding>
            </bindings>
            <behaviors>
                <endpointBehaviors>
                    <behavior/>
                </endpointBehaviors>
                <serviceBehaviors>
                    <behavior>
                        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
                        <serviceDebug includeExceptionDetailInFaults="false"/>
            <serviceCredentials>
                            <userNameAuthentication customUserNamePasswordValidatorType="Service Name with authenticater class" userNamePasswordValidationMode="Custom"/>
                            <serviceCertificate findValue="hash value" storeName="My" x509FindType="FindByThumbprint"/>
                        </serviceCredentials>
                    </behavior>
                </serviceBehaviors>
            </behaviors>
            <protocolMapping>
                <add binding="wsHttpBinding" scheme="https" bindingConfiguration="Binding1" />
            </protocolMapping>
            <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0"/>
        </system.serviceModel>

    Please help me on this.





    Tuesday, December 22, 2015 10:29 AM

Answers

All replies