When I try to call a WCF service I am getting the following message \"An error occurred when verifying security for the message.\"
When I remove the custom authenica
I was getting the same error and none of the above help for me.
I finally tracked it down to connectionStrings in a parent web.config (my service was deployed to a child application to an admin site).
Yes sounds ridiculous, but as soon as I wrapped the connection strings in the parent web.config with a location element all started working.
For clarity, in parent web.config, I changed this
<connectionStrings>
<add name="..." />
</connectionStrings>
to this
<location path="." inheritInChildApplications="false">
<connectionStrings>
<add name="..." />
</connectionStrings>
</location>
Note this error also resulted in this very unhelpful serviceSecurityAudit log message:
Message authentication failed.
Service: ...
Action: http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT
ClientIdentity:
ActivityId:
ArgumentNullException: Value cannot be null.
Parameter name: manager
I was getting the same error on my IIS 7.5 server. I forgot to add Read permission on the certificate's private key to the app pool virtual account (e.g. IIS AppPool\ASP.NET v4.0).
For info, whilst testing various combinations of accounts and permissions, I noticed that the app pool needed to be recycled to lose access to the key, once it had been retrieved once.
(0x80131501 - An error occurred when verifying security for the message.)