title: System.ServiceModel.Security.SecurityNegotiationException
body: <p>We have a WCF service, and if it's deployed on <em>localhost</em> we're able to call the service method, which means everything works fine.</p>
  
  <p>But, when we deploy the service to some another server there's an error:</p>
  
  <pre><code>System.ServiceModel.Security.SecurityNegotiationException occurred
    Message="The caller was not authenticated by the service."
    Source="mscorlib"
    StackTrace:
      Server stack trace:
          System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
          System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout)
          System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
          System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
          System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout)
          System.ServiceModel.Security.SecurityUtils.OpenTokenProviderIfRequired(SecurityTokenProvider tokenProvider, TimeSpan timeout)
          System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout)
          System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
          System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
          System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout)
          System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
          System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
          System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout)
          CryptoPro.Sharpei.ServiceModel.CPSecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout)
          System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout)
          System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout)
          System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
          System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
          System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
          System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
          System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
          System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
          System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
          System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
          System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
          System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
      Exception rethrown at [0]:
          System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
          System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
          Parus.BusinessObjects.ExternalServicesProxy.IAsurService.LoadCatalogItems(Decimal rn)
          Parus.BusinessObjects.ExternalServicesProxy.AsurServiceClient.LoadCatalogItems(Decimal rn) ? F:\!Work\8561\src\P8WebClient\Sources\Parus.BusinessObjects\Service References\ExternalServicesProxy\Reference.cs:?????? 154
          Parus.BusinessObjects.AsurDictionaries.AsurDictionariesLoader.Execute(ExternalAction action, ContentProvider contentProvider, IContextValueHolder contextValueHolder, ActionContext actionContext, OracleConnection connection) ? F:\!Work\8561\src\P8WebClient\Sources\Parus.BusinessObjects\AsurDictionaries\AsurDictionariesLoader.cs:?????? 19
    InnerException: System.ServiceModel.FaultException
         Message="Запрос маркера безопасности не удалось удовлетворить из-за сбоя проверки подлинности."
         Source="System.ServiceModel"
         Action="http://www.w3.org/2005/08/addressing/soap/fault"
         StackTrace:
              ? System.ServiceModel.Security.SecurityUtils.ThrowIfNegotiationFault(Message message, EndpointAddress target)
              ? System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState)
         InnerException:
  </code></pre>
  
  <p>I suppose we should change some settings in web.config file, but I'm not sure which one and where it should be on service side (on the server) or on the client side or both?</p>