Saturday, May 30, 2009

WCF: System.ServiceModel.FaultException: The message could not be processed

Problem: exception thrown when connecting to a WCF service

System.ServiceModel.FaultException: The message could not be processed. This is most likely because the action 'http://tempuri.org/IStockService/GetSymbolData' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.

Solution: at least in my case, there was a mismatch between the binding specified in the client (SecurityMode.None) and the server (wsHttpBinding). After specifiying the right binding in the client (SecurityMode.Message), it worked correctly.