我有一個可以作爲控制檯應用程序和Windows服務運行的WCF服務。我最近複製的控制檯應用程序多達W2K3服務器有下列安全設置:Windows服務中的WCF安全
<wsHttpBinding>
<binding name="ServiceBinding_Security" transactionFlow="true" >
<security mode="TransportWithMessageCredential" >
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="Common.CustomUserNameValidator, Common" />
</serviceCredentials>
安全工作正常,沒有任何問題。我有完全相同的代碼,但在Windows服務運行,我收到以下錯誤,當我嘗試調用任何方法從客戶端:
System.ServiceModel.Security.MessageSecurityException was unhandled
Message="An unsecured or incorrectly secured fault was received from
the other party. See the inner FaultException for the fault code and detail."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
......
(lots of stacktrace info - not very useful)
InnerException: System.ServiceModel.FaultException
Message="An error occurred when verifying security for the message."
例外告訴我什麼。我假設它與來自Windows服務的系統資源的訪問有關。我已經嘗試在與控制檯應用程序相同的帳戶下運行它,但沒有運氣。有沒有人有任何想法?
哎喲,這讓我頭疼...... – James 2009-10-13 15:20:26
安全信息是: <的wsHttpBinding> <綁定名稱= 「ServiceBinding_Security」 transactionFlow = 「真」> <安全模式= 「TransportWithMessageCredential」> \t <消息clientCredentialType = 「用戶名」/> \t \t \t \t \t \t \t 的wsHttpBinding> serviceCredentials> –
Alphonso
2009-10-13 15:21:20