【发布时间】:2011-12-20 15:16:20
【问题描述】:
我有一个带有 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)
尝试搜索解决方案,但没有找到符合我要求的解决方案,因此在此处发布。
可能是什么问题?
如果我在客户端上将安全模式设置为无
<security mode="None"></security>
我收到另一个错误:
错误:套接字连接被中止。这可能是由于处理您的消息时出错或远程主机超出接收超时,或者是潜在的网络资源问题引起的。本地套接字超时为 '00:00:59.5149722'。
【问题讨论】:
-
您应该指定 Windows 服务在哪个帐户中运行。是系统帐户/用户帐户吗?另外,您使用哪种 WCF 身份验证?
-
Windows 服务在本地系统帐户下运行,并且没有使用 WCF 身份验证。如果您需要任何其他信息,请告诉我
-
可能 NTLM 凭据失败。尝试以相同的客户端用户身份运行该服务。并查看:msdn.microsoft.com/en-us/library/ms730301(VS.90).aspx 匿名安全连接