1

我们有一个 WCF 服务,如果它部署在localhost上,我们就可以调用 service 方法,这意味着一切正常。

但是,当我们将服务部署到另一台服务器时,会出现错误:

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& 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:

我想我们应该更改 web.config 文件中的一些设置,但我不确定哪个以及它应该在服务端(在服务器上)还是在客户端或两者兼而有之?

4

0 回答 0