WCF Security in a Windows Service
- by Alphonso
I have a WCF service which can run as Console App and a Windows Service. I have recently copied the console app up to a W2K3 server with the following security settings:
<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>
Security works fine with no problems. I have exactly the same code, but running in a windows service and I get the following error when I try to call any of the methods from a client:
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."
The exception tells me nothing. I'm assuming that it has something to do with acces to system resources from the Windows Service. I've tried running it under the same account as the console app, but no luck. Does anyone have any ideas?