简体   繁体   English

呼叫者未通过服务认证。 使用wsHttpBinding和已传递凭据

[英]The caller was not authenticated by the service. Using wsHttpBinding and Already passing credentials

I went through the other posts on the site, but none could help me. 我浏览了网站上的其他帖子,但没有一个可以帮助我。

So here is the error description that i get. 所以这是我得到的错误描述。

    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)

And stack trace as follows: 并堆栈跟踪如下:

    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

Service configuration: 服务配置:

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

Client Side bindings (Building it in program) 客户端绑定(在程序中构建)

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);.

So i am trying to figure out what possibly has gone wrong, please note that the client and service was working fine till recently. 因此,我正在尝试找出可能出了问题的地方,请注意,直到最近,客户端和服务都可以正常工作。 We did make some security changes at server level. 我们确实在服务器级别进行了一些安全性更改。 I am clueless what broke the client app. 我不知道是什么原因破坏了客户端应用程序。

Any thoughts are appreciated. 任何想法表示赞赏。 I am trying to get a list of all the possibilities that can break the app in this scenario. 我正在尝试获取在这种情况下可能破坏应用程序的所有可能性的列表。 And hopefully can fix it. 并希望可以修复它。 Since app and service used to run fine, i would believe these two don't need any new changes. 由于应用程序和服务过去运行良好,我相信这两个不需要任何新的更改。

Thank you in advance. 先感谢您。

Service Account which used to run the application was locked and someone has changed its credentials. 用于运行该应用程序的服务帐户已被锁定,并且有人更改了其凭据。 We updated the service account, and that fixed the issue. 我们更新了服务帐户,从而解决了该问题。

So checking credentials of service account and making sure they are valid is one important thing to look for with such issues. 因此,检查服务帐户的凭据并确保它们有效是解决此类问题的重要一件事。 I hope it will help someone. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM