MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party...



    The full error is this:

    An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. --> System.ServiceModel.FaulException: The message could not be processed. This is most likely because the action "*" is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between the 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.


    I get this after the client has sat without any user interaction for some time.


    OK, so this is actually pretty clear once you get the bottom of it, BUT no matter what you increase the timeout to, there could still be a problem if you wait long enough. I create the proxy on startup and leave it created for the life of the application. I do have code to check the proxy.State and to re-create it if the state is Aborted, but it doesn't seem to change until you try to use the proxy and have it fail.


    Is it good practice to create the proxy and try to keep it around for the life of the application? Or, is it better to create the proxy each and every call? Is there a good way to detect client-side that the proxy has timed out and then recreate the proxy as needed?




    Tuesday, July 31, 2007 1:09 AM

All replies