首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >服务器已拒绝客户端凭据

服务器已拒绝客户端凭据
EN

Stack Overflow用户
提问于 2011-12-20 23:16:20
回答 7查看 49.4K关注 0票数 21

我有一个带有net.tcp绑定的WCF服务,作为Windows服务托管在服务器上。我无法访问此服务。然而,当我在我的本地网络上托管它时,我能够做到这一点。

收到的错误

消息:**服务器已拒绝客户端凭据。内部异常:

代码语言:javascript
复制
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

代码语言:javascript
复制
<security mode="None"></security>

我得到另一个错误:

错误:套接字连接已中止。这可能是由于处理消息时出错、远程主机超过了接收超时时间或基础网络资源问题造成的。本地套接字超时时间为‘00:00:59.5149722’。

EN

回答 7

Stack Overflow用户

回答已采纳

发布于 2012-01-13 11:01:16

我在尝试让DMZ中的服务器与我网络中的服务对话时也遇到了同样的问题。为我修复它的解决方案是将以下内容添加到app.config中:

注意安全节点。

代码语言:javascript
复制
<bindings>
  <netTcpBinding>
    <binding name="customTcpBinding" maxReceivedMessageSize="20480000" transferMode="Streamed" >
      <security mode="None"></security>
    </binding>
  </netTcpBinding>
</bindings>
票数 28
EN

Stack Overflow用户

发布于 2011-12-31 23:39:54

错误是TokenImpersonation错误。

似乎正在发生的事情是,调用进入,服务器端的一些代码要求用户由服务器代码模拟。

服务器代码是以本地系统帐户运行的,因此它无法模拟域用户。

您有两个基本选项:

  • 在允许模拟其他用户的用户的安全上下文中运行服务
  • 重写应用程序,以便不需要模拟
票数 6
EN

Stack Overflow用户

发布于 2012-02-16 17:24:38

我知道这个问题已经被回答为“关闭安全”。但如果任何人感兴趣,我确实设法在一个内部网环境中使用NetTcpBinding获得了WCF Transport Windows身份验证,在经历了很大的痛苦之后,我自己工作了。

从本质上讲,它归结为使用以下配置:

代码语言:javascript
复制
<security mode="Transport">
  <transport clientCredentialType="Windows" />
</security>

你可以在博客文章中看到更多细节。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8577612

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档