我有一个带有net.tcp绑定的WCF服务,作为Windows服务托管在服务器上。我无法访问此服务。然而,当我在我的本地网络上托管它时,我能够做到这一点。
收到的错误
消息:**服务器已拒绝客户端凭据。内部异常:
System.Security.Authentication.InvalidCredentialException:
The server has rejected the client credentials.
---> System.ComponentModel.Win32Exception:
The logon attempt failed --- End of inner exception stack trace
--- at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.NegotiateStream.AuthenticateAsClient(NetworkCredential credential, ChannelBinding binding, String targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel)
at System.Net.Security.NegotiateStream.AuthenticateAsClient(NetworkCredential credential, String targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel)
at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeInitiator.OnInitiateUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity)
尝试搜索解决方案,但没有找到符合我的要求,因此张贴在这里。
可能的问题是什么?
如果我在客户机上将安全模式设置为None
<security mode="None"></security>
我得到另一个错误:
错误:套接字连接已中止。这可能是由于处理消息时出错、远程主机超过了接收超时时间或基础网络资源问题造成的。本地套接字超时时间为‘00:00:59.5149722’。
发布于 2012-01-13 11:01:16
我在尝试让DMZ中的服务器与我网络中的服务对话时也遇到了同样的问题。为我修复它的解决方案是将以下内容添加到app.config中:
注意安全节点。
<bindings>
<netTcpBinding>
<binding name="customTcpBinding" maxReceivedMessageSize="20480000" transferMode="Streamed" >
<security mode="None"></security>
</binding>
</netTcpBinding>
</bindings>
发布于 2011-12-31 23:39:54
错误是TokenImpersonation错误。
似乎正在发生的事情是,调用进入,服务器端的一些代码要求用户由服务器代码模拟。
服务器代码是以本地系统帐户运行的,因此它无法模拟域用户。
您有两个基本选项:
发布于 2012-02-16 17:24:38
我知道这个问题已经被回答为“关闭安全”。但如果任何人感兴趣,我确实设法在一个内部网环境中使用NetTcpBinding获得了WCF Transport Windows身份验证,在经历了很大的痛苦之后,我自己工作了。
从本质上讲,它归结为使用以下配置:
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
你可以在博客文章中看到更多细节。
https://stackoverflow.com/questions/8577612
复制相似问题