I have 2 servers. Each of them has one WCF service installed. The client connects to the services through the load balancer. The load balancer distributes requests to these 2 servers. When the load balancer redirects the request to the same server on which the client is located, a security error occurs. When the load balancer redirects the request to another server, everything works fine. Error:
System.ServiceModel.Security.SecurityNegotiationException: The server has rejected the client credentials.
---> System.Security.Authentication.InvalidCredentialException: The server has rejected the client credentials.
---> System.ComponentModel.Win32Exception: The logon attempt failed
--- End of inner exception stack trace ---
at System.Net.Security.NegoState.EndProcessAuthentication(IAsyncResult result)
at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeInitiator.InitiateUpgradeAsyncResult.OnCompleteAuthenticateAsClient(IAsyncResult result)
at System.ServiceModel.Channels.StreamSecurityUpgradeInitiatorAsyncResult.CompleteAuthenticateAsClient(IAsyncResult result)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass7_0`1.<CreateGenericTask>b__0(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
The configurations are as below:
<binding name="bindingName"
receiveTimeout="02:00:00"
sendTimeout="02:00:00"
maxBufferPoolSize="1524288"
maxReceivedMessageSize="20553600">
<readerQuotas maxArrayLength="1024000000" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
<endpoint
address="net.tcp://localhost:5555/endpoint"
binding="netTcpBinding"
bindingConfiguration="bindingName"
contract="IContract">
<identity>
<dns />
</identity>
</endpoint>
<behavior name="behaviorName">
<serviceMetadata httpGetEnabled="False"/>
<serviceDebug includeExceptionDetailInFaults="False"/>
<serviceThrottling maxConcurrentCalls="128000"
maxConcurrentSessions="128000"
maxConcurrentInstances="128000" />
</behavior>