我能够使用Win-form应用程序连接到我的WCF服务,但是我无法使用我的Windows服务进行此操作。每当我火open()来代理它抛出以下错误服务器已拒绝客户端凭据,WCF作为Windows服务
服务器拒绝了客户端证书
内部异常:System.Security.Authentication.InvalidCredentialException:服务器 拒绝了客户端证书。
---> System.ComponentModel.Win32Exception:登录尝试失败
---内部异常堆栈跟踪的结尾---
在System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult)
在System.Net.Security.NegotiateStream.AuthenticateAsClient(的NetworkCredential 凭证,ChannelBinding结合,字符串目标名称,的ProtectionLevel requiredProtectionLevel,TokenImpersonationLevel allowedImpersonationLevel)
在System.Net.Security.NegotiateStream.AuthenticateAsClient(的NetworkCredential 凭证,字符串目标名称,保护ionLevel requiredProtectionLevel,TokenImpersonationLevel allowedImpersonationLevel)
在System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeInitiator.OnInitiateUpgrade(流 流,SecurityMessageProperty & remoteSecurity)
试图寻找解决方案,但没有装修我的要求,因此,发布。
请帮助...
更新1:
@ A.R,尝试使用
client.ClientCredentials.Windows.AllowedImpersonationLevel =
System.Security.Principal.TokenImpersonationLevel.Impersonation;
,但无济于事。
更新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 includeExceptionDetailInFaults="True" />
<serviceThrottling
maxConcurrentCalls="32"
maxConcurrentSessions="32"
maxConcurrentInstances="32"
/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
更新了问题请检查 – Bravo 2012-01-09 14:54:08
好的,你必须真实地告诉它是谁模仿。你不能只设置旗帜,并期望它神奇地冒充某人。阅读第二个链接中提供的材料。 – 2012-01-09 15:27:00