web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM 2011, Error : The security context token is expired or is not valid. The message was not processed.

(0) ShareShare
ReportReport
Posted on by

Hello,

We have a CRM organization that is updated client info every night with information from our store.

The update is done with CRM SDK

We could go up to 6000 clients to update for a night.

If one update has an error (Like rom CRM  plugins ), we log the error and update the next client.

Lately we keep having the following error the comes up every half hour, :

An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.

 


Between the call to update and the error being raised, the update seem to hang for about 20 minutes. 

After logging the error, the next client is updated with an error.

We've look at the solution

https://community.dynamics.com/crm/b/dynamicscrmconnector/archive/2012/10/01/security-token-errors-in-wcf-services

But it did solve or problem.

Does anybody has an idea what could be creating the error ?

Here is the trace stack for our error:

2015/07/02 09:38:59 - [CCM.GetCIOCustomer.exe] - CIO_NewCustomersID : 14845 [EntityNum=000280,CustomerNumber=409901] - An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.

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.Dispatcher.RequestChannelBinder.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)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Xrm.Sdk.IOrganizationService.Update(Entity entity)
   at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.UpdateCore(Entity entity)
   at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Update(Entity entity)
   at UAP.Crm.GetCIOCustomer.CRMEntitiesMGR.StoreCustomerAccount(CIO_NewCustomer customer, Boolean isCreation, Boolean becameGeneric)
   at UAP.Crm.GetCIOCustomer.GetCIOCustomerMGR.UpdateCustomerAccount(CIO_NewCustomer customer)
   at UAP.Crm.GetCIOCustomer.GetCIOCustomerMGR.Step_07_ProcessCIOCustomerAccount()
The security context token is expired or is not valid. The message was not processed.

Thank you

 

 

 

 

*This post is locked for comments

I have the same question (0)
  • Royal King Profile Picture
    27,686 on at

    Do you have Claim based authetication enabled on the crm ? If so i may be security token expiration causing this issue. Take a look at below post that provides more info on it.

    To fix this issue you need to renew security token. CRM SDK has helper class to check the validity of the token and renews automatically.

    https://technet.microsoft.com/en-us/library/gg188586(v=crm.6).aspx

    The lifetime of a default security token for a claims-based authentication deployment using AD FS 2.0 is 60 minutes. By default, Microsoft Dynamics CRM Server 2011 is configured to display the Authentication is Required dialog box 20 minutes before the token expires.

    In the Authentication is Required dialog box, if you click Cancel, the token expires as indicated. When the security token expires, you will need to start a new browser session to Microsoft Dynamics CRM to access your data. Any unsaved changes will be lost.

  • Community Member Profile Picture
    on at

    Hello Chitra,

    Unfortunately we are not using Claim based authentication.

     

     

    I've created a simple C# test program that updated one field of the same entity record in an endless loop.

    We have a Quality Control server which hosts two CRM organisations with the same solution.

    The test program was run on each organisation. One of the organisations didn't return any error. While the other return an error every 30 minutes. 

  • Royal King Profile Picture
    27,686 on at

    May be issue resides in CRM server itself. Did you take look at crm server event viewer for any error messages?

  • Community Member Profile Picture
    on at

    Last night the error was generated twice.

    For both occasion, the server event log show's no error.

     

    It's not the error that bothers us. We could implement a retry in our code.

    It's the fact that each error takes about 16 minutes to get raised after the call for an update or create.

    We get the error two times in an hour. So half the time the our batch process is waiting for an error.

     

  • Community Member Profile Picture
    on at

    I've look in the event log and found nothing.

     

    Since it seems to be that the token has expired, I forces a proxy.Authenticate() before every call to the CRM service. By doing so, the error has not returned.

     

    But, I do not want to call the proxy.Authenticate() method on every service call.

    If found this example to validate if the token need to be renewed:

    if ( null != proxy.SecurityTokenResponse && DateTime.UtcNow.AddMinutes(15) >= CRMproxy.SecurityTokenResponse.Response.Lifetime.Expires)

    CRMproxy.Authenticate();

     

    My problem is that the SecurityTokenResponse object is always null and I can’t validate the expiration date of the token.

  • skhan Profile Picture
    120 on at

    Hi, We are having the same issue. Did you find any other solution for it ?? 

  • Rajesh Sunkara Profile Picture
    21 on at

    Hi

    We are facing the same issue. SecurityTokenResponse is always null. Did you find any solution ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans