小编Bra*_*avo的帖子

服务器已拒绝客户端凭据

我有一个带有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)
Run Code Online (Sandbox Code Playgroud)

尝试搜索解决方案,但发现没有符合我的要求,因此发布在这里.

可能是什么问题呢?

如果我在客户端上将我的安全模式设置为"无"

<security mode="None"></security>
Run Code Online (Sandbox Code Playgroud)

我收到另一个错误:

错误:套接字连接已中止.这可能是由于处理消息的错误或远程主机超出接收超时或基础网络资源问题引起的.本地套接字超时为'00:00:59.5149722'.

wcf net.tcp

19
推荐指数
2
解决办法
4万
查看次数

Web服务分析器错误消息:无法创建类型'xxx'

我尝试浏览我的Web服务时收到解析器错误.

已经找到了这么多答案,但没有人帮助我.如果有人可以引导我找到一个我可能忽略的有用链接,那将会有很大的帮助.

这是场景:

我有在IIS 7.5上托管的VS-2010(框架4.0)内置的Web服务,它使用"ASP.NET v4.0 Classic"应用程序池.这曾经工作正常,直到我重新安装它.它开始显示下面的错误


分析器错误

说明:解析为此请求提供服务所需的资源时发生错误.请查看以下特定的解析错误详细信息并相应地修改源文件.

分析器错误消息:无法创建类型"AuthenticateUser".

来源错误:

第1行:<%@ WebService语言="C#"CodeBehind ="〜/ App_Code/AuthenticateUser.cs"Class ="AuthenticateUser"%>

源文件: /WebService101/Services/AuthenticateUser.asmx 行: 1

版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.1016


请帮忙.

web-services iis-7.5 c#-4.0

13
推荐指数
3
解决办法
3万
查看次数

服务器已拒绝客户端凭据,WCF作为Windows服务

我能够使用Win-form应用程序连接到我的WCF服务,但是我无法使用我的Windows服务.每当我向代理触发open()时,它都会抛出以下错误

服务器已拒绝客户端凭据

内部异常:System.Security.Authentication.InvalidCredentialException:服务器已拒绝客户端凭据.
---> System.ComponentModel.Win32Exception:登录尝试失败
---内部异常堆栈跟踪结束---
在System.Net.Security.NegotiateStream.AuthenticateAsClient处的System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult)
处(的NetworkCredential凭证,ChannelBinding结合,字符串目标名称,的ProtectionLevel requiredProtectionLevel,TokenImpersonationLevel allowedImpersonationLevel)
在System.Net.Security.NegotiateStream.AuthenticateAsClient(的NetworkCredential凭证,字符串目标名称,的ProtectionLevel requiredProtectionLevel,TokenImpersonationLevel allowedImpersonationLevel)
在System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeInitiator. OnInitiateUpgrade(Stream stream,SecurityMessageProperty&remoteSecurity)

尝试寻找解决方案,但没有符合我的要求,因此发布.

请帮忙...

更新1:

@AR,尝试使用

client.ClientCredentials.Windows.AllowedImpersonationLevel =
    System.Security.Principal.TokenImpersonationLevel.Impersonation;
Run Code Online (Sandbox Code Playgroud)

但无济于事.

更新2:

WCF服务配置

<system.serviceModel>
    <diagnostics performanceCounters="All" />
    <bindings>
      <netTcpBinding>
        <binding name="myBindingForLargeData" maxReceivedMessageSize="5242880" maxConnections="10">
          <readerQuotas maxDepth="64" maxStringContentLength="5242880" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
        </binding>
      </netTcpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="WCFService.ServiceBehavior"
        name="WCFService.CollectorService">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="myBindingForLargeData"
          name="netTcpEndPoint" contract="WCFService.ICollectorService" />
        <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
          name="mexTcpEndPoint" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:8010/WCFService.CollectorService/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WCFService.ServiceBehavior">
          <serviceMetadata httpGetEnabled="False"/>
          <serviceDebug …
Run Code Online (Sandbox Code Playgroud)

c# wcf windows-services net.tcp winforms

9
推荐指数
1
解决办法
3万
查看次数

将数据表发送到WCF服务时出现序列化错误

序列化消息体Method1时出错:'生成XML文档时出错.'

当我尝试将数据表作为参数传递给WCF方法时,我收到此错误,我已经DataTable在我的WCF服务中使用了这种类型的方法(即作为参数),这很好.

但是在这种情况下,我认为原因可能是大小DataTable,但不确定.

已经尝试过增加maxReceivedMessageSize,maxBufferSize并且maxStringContentLength到5242880即5 MB(我觉得绰绰有余),但没有运气.

发现了许多相关的文章,但没有人指出这个特定的问题,因此发布.

请指导.

Update:

DataTable还包含一些XML内容,这可能是问题,因为它是以XML格式序列化的.

c# wcf nettcpbinding

3
推荐指数
1
解决办法
3927
查看次数