Eu tenho 2 servidores. Cada um deles tem um serviço WCF instalado. O cliente se conecta aos serviços por meio do balanceador de carga. O balanceador de carga distribui solicitações para esses dois servidores. Quando o balanceador de carga redireciona a solicitação para o mesmo servidor no qual o cliente está localizado, ocorre um erro de segurança. Quando o balanceador de carga redireciona a solicitação para outro servidor, tudo funciona bem. Erro:
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
As configurações são as seguintes:
<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>