Symptom:
Error Message when trying to login to CRM
Other related errors from Event Viewer:
Current key (KeyType : CrmWRPCTokenKey) is expired. This can indicate that a key is not being regenerated correctly. Current Key : CrmKey(Id:abcde-fghi-jklm, ScaleGroupId:00000000-0000-0000-0000-000000000000, KeyType:CrmWRPCTokenKey, Expired:True, ValidOn:08/05/2015 16:01:01, ExpiresOn:09/07/2015 16:01:01, CreatedOn:08/05/2015 16:01:01, CreatedBy:CRMADMINISTRATOR.
Recommendations:
- Short-term solution: reboot Report Server
- Medium-term solution: Set a scheduled task on the Report Server to execute the script at the bottom of this article
- Program to run: powershell.exe
- Argument: -ExecutionPolicy Bypass c:\scripts\clearStuckQueue.ps1
- Trigger: upon task creation, repeat every 30 minutes, duration indefinitely
- Long-term solution:
- If the asyncoperationbase table contains 50,000+ records, it should be truncated. An oversized asyncoperation table is a common source of performance issues and database deadlocks.
- Set a SQL trace for frequently occurring deadlocks. If detected, trigger a cleanup & tuning of database.
- Set stored procedures to reduce the number of round trips between your application and SQL.
- Use the lowest possible isolation level for the user connection running the transaction.
- Ensure that the system I/O doesn’t become a bottleneck to SQL operations
- Add more RAM to SQL server if necessary
# Change this variable
$environment='SALES01'
# Executing as Administrator (e.g CRMADMINISTRATOR or DOMAIN\Administrator)
$asyncNode="$environment-async01"
invoke-command -ComputerName $asyncNode -scriptblock{
$crmTools=if(test-path "$env:programfiles\dynamics 365"){"$env:programfiles\dynamics 365\Tools"}else{"$env:programfiles\Microsoft Dynamics CRM\Tools"}
# Restart Microsoft Dynamics CRM Asynchronous Services
get-service|?{$_.name -like 'MSCRMAsyncService*'}|restart-service
# Renew keys to CRM App server
& "$crmTools\Microsoft.Crm.Tools.WRPCKeyRenewal.exe" /R
sleep 3
# Restart Microsoft Dynamics CRM Asynchronous Service (maintenance)
get-service|?{$_.DisplayName -like 'Microsoft Dynamics*(maintenance)'}|restart-service
}