"The security context token is expired or is not valid. The message was not processed." error in CRM 2011 execute method. RRS feed

  • Question

  • Getting the below error while calling the CRM execute method. This is intermittent. Is there any specific root cause for this?

    System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---> System.ServiceModel.FaultException: The security context token is expired or is not valid. The message was not processed.

             --- End of inner exception stack trace ---


          Server stack trace:

             at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)

             at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)

             at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

             at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

             at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Wednesday, November 26, 2014 11:10 AM

All replies

  • Put put your code on the forum.

    Regards Faisal

    Wednesday, November 26, 2014 12:53 PM
  • The information posted so far isn't sufficient to diagnose the issue:

    • The exception message references an FaultException - can you catch the exception as a FaultException and include the full inner exception details
    • What message(s) are you passing to the Execute method ?
    • Where is your code running - e.g. within CRM in a plugin, or external to CRM, e.g. in a separate process
    • How are you instantiating the IOrganizationService instance, and how long is it instantiated for ? For some authentication mechanisms (see below) the token will expire after a time, and you'll have to reauthenticate
    • What authentication mechanism is CRM using (AD, Claims, Online) ?

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Wednesday, November 26, 2014 5:12 PM