呼叫者未通过该服务进行身份验证。使用wsHttpBinding并已经传递凭据

时间:2014-06-17 16:00:06

标签: .net wcf security wcf-binding wcf-security

我浏览了网站上的其他帖子,但没有人可以帮助我。

所以这是我得到的错误描述。

    The caller was not authenticated by the service.
INNER EXCEPTION: System.ServiceModel.FaultException: The request for security token could not be satisfied because authentication failed.
   at System.ServiceModel.Security.SecurityUtils.ThrowIfNegotiationFault(Message message, EndpointAddress target)
   at System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState)

堆栈跟踪如下:

    Server stack trace: 
       at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
       at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout)
       at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
       at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout)
       at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout)
       at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]: 
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

   at TTasks.EmailSvc.ISendMailService.SendMailWithUri(EmailMessage emailMessageDataContract, String uri)
   at TTasks.EmailSvc.SendMailServiceClient.SendMailWithUri(EmailMessage emailMessageDataContract, String uri) in C:\Projects\Test Project\TTasks\Service References\EmailSvc\Reference.cs:line 251

服务配置:

<services>
    <service name="WcfEndpoint.SendMailService" behaviorConfiguration="WcfEndpoint.SendMailServiceBehavior">                
        <endpoint address="Email"  binding="wsHttpBinding" contract="WcfEndpoint.ServiceContract.ISendMailService" bindingConfiguration="LargeFileBinding">
            <identity>                        
                <dns value="localhost"/>
            </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    </service>
</services>

客户端绑定(在程序中构建)

WSHttpBinding wsb = new WSHttpBinding(SecurityMode.Message, false);
            wsb.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
            wsb.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
            wsb.Security.Message.NegotiateServiceCredential = true;
            wsb.Security.Message.EstablishSecurityContext = true;

            _mailClient = new EmailSvc.SendMailServiceClient    (wsb, ep);.

所以我想弄清楚可能出了什么问题,请注意客户端和服务直到最近才能正常工作。我们确实在服务器级别进行了一些安全性更改什么打破了客户端应用程序我一无所知。

任何想法都表示赞赏。我试图获得一个列表,列出在这种情况下可能破坏应用程序的所有可能性。希望能解决它。由于应用程序和服务运行良好,我相信这两个不需要任何新的更改。

提前谢谢。

1 个答案:

答案 0 :(得分:0)

用于运行应用程序的服务帐户已被锁定,并且有人更改了其凭据。我们更新了服务帐户,这解决了问题。

因此,检查服务帐户的凭据并确保它们有效是一个重要的事情,以寻找这些问题。我希望它会帮助别人。