我能夠使用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