Search code examples
wcfwcf-securitywcf-client

WCF Error: The identity check failed for the outgoing message


i am trying to consuming wcf web service and got error

The identity check failed for the outgoing message. The expected identity is 'identity(http://schemas.xmlsoap.org/ws/2005/05/identity/right/possessproperty: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn)' for the 'http://localhost/SCVMMService/VirtualMachineManagementService.svc' target endpoint.

for consuming webservice i am using code :

Client.ClientCredentials.Windows.ClientCredential.Domain = "testlab.ourcp.com";
  Client.ClientCredentials.Windows.ClientCredential.UserName = "administrator";
  Client.ClientCredentials.Windows.ClientCredential.Password = "M!ndMasT23";
  Client.ClientCredentials.UserName.UserName = "administrator";
  Client.ClientCredentials.UserName.Password = "M!ndMasT23";        
  Client.Open();

WebConfig:

<bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_IVirtualMachineManagementService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
                    <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
                    <security mode="Message">
                        <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
                        <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"/>
                    </security>
                </binding>
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost/SCVMMService/VirtualMachineManagementService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IVirtualMachineManagementService" contract="ServiceReference1.IVirtualMachineManagementService" name="WSHttpBinding_IVirtualMachineManagementService">
                <identity>
                    <servicePrincipalName value="DDC-SC-VMM02.testlab.ourcp.com\Administrator"/>
                </identity>
            </endpoint>
        </client>

and in webService config file for identity use:

    <dns value="localhost"/>

Solution

  • Is the WCF service you're trying to access configured to use Service Identity? If not, remove the entire identity element from the endpoint element because it's only used with the Service Indentity feature.