WCF: Security Token Request Cannot Be Satisfied Because Authentication Failed

I have two WCF services on the same computer. One of them is a publisher, and one is a listener.

Publisher dynamically creates proxy servers based on and endpoint. I configure the proxies in the code as follows:

            WSHttpBinding binding = new WSHttpBinding(SecurityMode.Message, true);
            binding.Security.Message.NegotiateServiceCredential = true;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
            binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
            binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
            binding.Security.Message.EstablishSecurityContext = true;
            binding.ReliableSession.Enabled = true;
            binding.TransactionFlow = true;
            return binding;

and then...

            Binding binding = GetBindingFromAddress(address);

            ChannelFactory<T> factory = new ChannelFactory<T>(binding);
            factory.Credentials.UserName.UserName = "an account on the machine";
            factory.Credentials.UserName.Password = "a password for that account";

            T proxy = factory.CreateChannel(new EndpointAddress(address));

When I go to call, I get the above error. Here is my listener configuration file:

   <service behaviorConfiguration="MEX Enabled" name="InvoiceSubscriber">
<endpoint binding="wsHttpBinding"
          bindingConfiguration="ReliableTransactionalHTTP"
          contract="AtlanticBT.SubscriptionService.Contracts.v1.IAtlanticEvents">
 <identity>
  <dns value="localhost" />
 </identity>
</endpoint>

        <bindings>
        <wsHttpBinding>
            <binding name="ReliableTransactionalHTTP" transactionFlow="true">
                <reliableSession enabled="true"/>
      <security mode="Message">
        <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
        <message clientCredentialType="Windows" negotiateServiceCredential="true" 
                 algorithmSuite="Default" establishSecurityContext="true"/>
      </security>
            </binding>
  </wsHttpBinding>
    </bindings>

I checked all my ACLs in the directories that host the services and they seem to be correct. IIS security is configured for anonymous access and Windows authentication.

So, if I explicitly set credentials in code, why can't my listener authenticate?

+3
1

-, , , , Windows. ?

-, Windows. Windows , . , , , .

-, , , " Windows", UsernameClientCredentials ClientCredentials. , Windows. Windows .

, Windows, :

# 1, , # 2, /, .

, , Windows:


, , . , / , , .

+16

Source: https://habr.com/ru/post/1721321/


All Articles