Search This Blog

Sunday, October 2, 2022

Dynamics 365 2 minutes plugin time out workaround

Plugin or custom workflow activity run in isolation mode "sandbox" will have hard limit 2 minutes. In case your plugin is complex and need more than 2 minutes, there are some workaround for this.

For CRM onpremise

  1. Change plugin isolation mode to "None"Dynamics 365 2 minutes plugin time out workaround

     

  2. Open registry editor and change some values (in CRM server)
    1. HKEY_LOCAL_MACHINE\Software\Microsoft\MSCRM\SandboxClientOperationTimeoutInSec as a REG_DWORD key with a value in decimal greater than 120 (default is 120, which is equivalent to 2 minutes).

    2. HKEY_LOCAL_MACHINE\Software\Microsoft\MSCRM\SandboxHostOperationTimeoutInSec as a REG_DWORD key with a value in decimal greater than 120 (default is 120, which is equivalent to 2 minutes).  

    3. HKEY_LOCAL_MACHINE\Software\Microsoft\MSCRM\SandboxWorkerOperationTimeoutInSec as a REG_DWORD key with a value in decimal greater than 120 (default is 120, which is equivalent to 2 minutes).  

    4. HKEY_LOCAL_MACHINE\Software\Microsoft\MSCRM\OleDbTimeout as a REG_DWORD key with a value in decimal. Note The value of 600 represents 600 seconds. By default, the value is 30 seconds. You may need to set this to 86400 which is equivalent to a value of 24 hours.  

  3. Change Web.config in CRM server
    1. Open C:\Program Files\Dynamics 365\CRMWeb\Web.config in CRM server
    2. Change the attribute httpRuntime executionTimeout="86400" (means 24h), default value is 300 means 5 mins
    3. Dynamics 365 2 minutes plugin time out workaround
  4. If your plugins can not run in mode "Sandbox", you can move the logic of the plugin to custom workflow activity, then you can run the workflow on demand or automatically with the trigger same as filtering attributes in plugin then try to run the wokflow in mode "None"

 

For CRM online

We can not change registry or web.config in CRM online. There are some workaround solutions:

  1. Move the whole logic of the plugin to Azure Function, then call Azure Function in the plugin.
  2. Move the whole logic of the plugin to a shedule job (console application), then setup this job run every some minutes. If you have a server, you can use window task scheduler or you can run it in Azure

No comments:

Post a Comment