title: WCF Net.tcp with sspi fails unless client and server using same windows Identity
body: <p>I have a <strong>WCF</strong> Service being hosted by a windows service.  The client app succeeds if I log on to the client machine using the same credentials as the service is running under, but it fails with an exception if I am logged in with any other valid domain account.</p>
  
  <p>I have two accounts that I am testing with, one is an ordinary user account and the other account is an admin account.  I have tried all four combinations listed below:</p>
  
  <pre><code>                   Server account
     CLient      RegUser    AdminAcct   
    RegUser     Succeeds      Fails   
   AdminAcct     Fails       Succeeds    
  </code></pre>
  
  <p>As you can see it cannot be an admin issue as the system works when both client and server are running under the non-admin account. 
  In both cases where it fails I get the same exception, on the client, with no indication of anything happening in the server logs:   </p>
  
  <blockquote>
    <p>"A call to SSPI failed. see inner exception"</p>
  </blockquote>
  
  <p>The inner exception is <strong>"The target principle name is incorrect."</strong></p>
  
  <p>I have registered the accounts as SPNs.  </p>
  
  <p>The problem only occurs from my client app, but not when I use the <code>WCVFTestClient.exe</code> which ships with Visual Studio.</p>
  
  <p>The exception, in the WCF Trace log, is</p>
  
  <blockquote>
    <p>"System.ServiceModel.Security.SecurityNegotiationException,
    System.ServiceModel, Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089"</p>
  </blockquote>
  
  <p>with a message:</p>
  
  <p><strong>"Authentication failed on the remote side (the stream might still be available for additional authentication attempts)."</strong></p>
  
  <p>The stack trace is at the bottom:
  What is wrong ?</p>
  
  <p>stack trace</p>
  
  <hr>
  
  <blockquote>
    <p>System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeAcceptor.OnAcceptUpgrade(Stream
    stream, SecurityMessageProperty&amp; remoteSecurity)
    System.ServiceModel.Channels.StreamSecurityUpgradeAcceptorBase.AcceptUpgrade(Stream
    stream)
    System.ServiceModel.Channels.InitialServerConnectionReader.UpgradeConnection(IConnection
    connection, StreamUpgradeAcceptor upgradeAcceptor,
    IDefaultCommunicationTimeouts defaultTimeouts)
    System.ServiceModel.Channels.ServerSessionPreambleConnectionReader.ServerFramingDuplexSessionChannel.OnOpen(TimeSpan
    timeout)
    System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan
    timeout)
    System.ServiceModel.Dispatcher.ChannelHandler.OpenAndEnsurePump()
    System.Runtime.ActionItem.DefaultActionItem.TraceAndInvoke()
    System.Runtime.ActionItem.CallbackHelper.InvokeWithoutContext(Object
    state)
    System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32
    errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
    System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32
    error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
    System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32
    errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)</p>
  </blockquote>