locked
WCF SOAP Service with custom authentication RRS feed

  • 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

  • I'd try them over here.

    http://forums.asp.net/28.aspx/1?WCF+ASMX+and+other+Web+Services

     

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    • Proposed as answer by Mike Laughlin Tuesday, December 22, 2015 2:12 PM
    • Marked as answer by Just Karl Tuesday, December 29, 2015 4:27 PM
    Tuesday, December 22, 2015 1:41 PM
  • thanks Dave.
    Tuesday, December 22, 2015 1:58 PM
  • You're welcome.

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    Tuesday, December 22, 2015 2:20 PM