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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

The security timestamp is stale because its expiration time xxx is in the past. Current time is xxx and allowed clock skew is '00:05:00'.

(0) ShareShare
ReportReport
Posted on by 170

Hi,

I am using C#.NET SDK to connect to CRM (CRM 2015 on-premise) and able to connect successfully and fetch the less number of records, but when I try to fetch the account records (20K+) by using SDK then service is taking too much time to respond, almost an hour. In the end, it is returning either records (5000-page size) or sometimes the below exception - 

The security timestamp is stale because its expiration time ('2018-05-21T06:49:22.244Z') is in the past. Current time is '2018-05-21T08:02:00.358Z' and allowed clock skew is '00:05:00'.

All the client-server machines have the internet time set correctly. There must be no issues of different time as I am able to log in by SDK and fetch user records (less in numbers).

Please help me in resolving this issue.

*This post is locked for comments

I have the same question (0)
  • David Jennaway Profile Picture
    14,065 on at
    RE: The security timestamp is stale because its expiration time ('2018-05-21T06:49:22.244Z') is in the past. Current time is '2018-05-21T08:02:00.358Z' and allowed clock skew is '00:05:00'.

    I expect the problem is that you need to reauthenticate with the CRM Server. There are 2 main approaches you can take:

    1. You could catch the exception, then reinstantiate the IOrganizationService instance (or whatever class you are using to connect to CRM)
    2. If you know the token expiry duration (from the error it looks like it is ~1 hour), then you code could record the time that it starts, then check during the processing if it is close to the token expiry duration, and if so reinstantiate the IOrganizationService instance
  • MSCRM learner Profile Picture
    170 on at
    RE: The security timestamp is stale because its expiration time ('2018-05-21T06:49:22.244Z') is in the past. Current time is '2018-05-21T08:02:00.358Z' and allowed clock skew is '00:05:00'.

    Thanks, David for your reply.

    Thanks for suggesting these two approaches.

    when I am executing the below statement :

    retrieved = (RetrieveMultipleResponse)service.Execute(retrieve);

    it is taking almost one hour to respond as you can see the time in the error message

    1. You could catch the exception, then re-instantiate the IOrganizationService instance (or whatever class you are using to connect to CRM).

      I am already catching the exception but I didn't get about the re-instantiation. Even if I re-instantiate the service, and again execute the same statement it will be another call to service.

    1. If you know the token expiry duration (from the error it looks like it is ~1 hour), then your code could record the time that it starts, then check during the processing if it is close to the token expiry duration, and if so re-instantiate the IOrganizationService instance

    As execution of only the single statement is taking an hour time and then throwing exception how do I can check the token expiry when the statement is in execution.

    It would be really helpful if you please explain me in detail or with examples.

  • Suggested answer
    unizap Profile Picture
    on at
    RE: The security timestamp is stale because its expiration time ('2018-05-21T06:49:22.244Z') is in the past. Current time is '2018-05-21T08:02:00.358Z' and allowed clock skew is '00:05:00'.

    You may try reducing the page size to somewhere around 500 - 1000 records per page.

    Also, check for resource utilization on server when the query is running. You might need to free up some resources or add additional resources to server.

  • MSCRM learner Profile Picture
    170 on at
    RE: The security timestamp is stale because its expiration time ('2018-05-21T06:49:22.244Z') is in the past. Current time is '2018-05-21T08:02:00.358Z' and allowed clock skew is '00:05:00'.

    Thanks, Mayank for the reply.

    I tried by 1000 records, it is working and giving me the records. Previously I was trying with 5000 records per page.

    But as you have replied about the resource utilization on the server and freeing up some resources, is it mean that the CRM server is running slow. So if I need to retrieve 5000 records at a time then should I need to work on the CRM configurations. 

    Please help me in understanding this as I need to inform the customer about their CRM server problem.

  • Verified answer
    unizap Profile Picture
    on at
    RE: The security timestamp is stale because its expiration time ('2018-05-21T06:49:22.244Z') is in the past. Current time is '2018-05-21T08:02:00.358Z' and allowed clock skew is '00:05:00'.

    By fetching 1000 records at time gives you acceptable performance, then I would recommend to keep that as page size. No need to reconfigure CRM server.

    Only thing to understand here is that fetching 5000 records per page may not always be a good idea.

    If you wish to improve performance you could consider PLINQ

    docs.microsoft.com/.../introduction-to-plinq

  • MSCRM learner Profile Picture
    170 on at
    RE: The security timestamp is stale because its expiration time xxx is in the past. Current time is xxx and allowed clock skew is '00:05:00'.

    Thanks, Mayank for your reply.

    I am changing my code to read less number of records as I can not move my code to Linq.

    but still, I just want to dig in this issue in detail. Why this issue happened only for this customer while my other customers are running successfully with the same code and page size 5000. The CRM server must be running slow I guess. 

    If I want to execute for 5000-page size anyhow then shall I need to look into CRM configuration?

    Please help me in understanding what might be the root cause of the issue.

    Thanks in advance.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans