简体   繁体   English

如何在CRM 2011中增加插件的最大执行时间?

[英]How to increase plugin maximum execution time in CRM 2011?

Is there any way to increase the maximum time that a plugin can execute for? 有没有办法增加插件可以执行的最长时间?

It's 2 minutes by default. 默认情况下是2分钟。 I found that here . 我在这里找到

The limit is there to help protect the performance of the server, so the correct approach here is to re-engineer your solution (eg move your intensive logic out into a workflow or a web service and call it asynchonrously). 限制是为了帮助保护服务器的性能,因此这里正确的方法是重新设计您的解决方案(例如,将您的密集逻辑移到工作流程或Web服务中并以异步方式调用它)。

I'm not aware of any setting, flag or registry entry that will extend the two-minute timeout, though if you must persevere, you may find it possible to fudge a solution by wrapping your logic in a try/catch block, catch ing System.TimeoutException and continuing your code. 我不知道任何设置,标志或注册表项,将延长两分钟的超时,但如果你一定要坚持下去,你会发现它可以通过在try / catch块包裹你的逻辑胡编乱造一个解决方案, catch荷兰国际集团System.TimeoutException并继续您的代码。 Maybe (untested). 也许(未经测试)。

I'd like to add that it seems that the time limit only applies when a plugin is registered in a sandbox / partial trust mode. 我想补充说,似乎时间限制仅适用于在沙箱/部分信任模式下注册插件时。

We had this kind of an issue and solved it by registering the plugin in fully trusted (non-sandbox) mode. 我们遇到了这种问题,并通过在完全受信任(非沙盒)模式下注册插件来解决它。 I verified this by using Thread.Sleep function to wait 2 minutes before even starting to executing any plugin logic. 我通过使用Thread.Sleep函数等待2分钟甚至开始执行任何插件逻辑来验证这一点。 In total almost 4 minutes were spent but the plugin still managed to do well when in non-sandbox mode. 总共花了将近4分钟,但是在非沙箱模式下插件仍能保持良好状态。 In a sandbox mode it threw us a 2 minutes exception. 在沙盒模式下,它给我们一个2分钟的例外。

According to E-learning material from Microsoft sandbox plugins in CRM 2013 has only 30 seconds limit instead of 120 seconds. 根据来自微软的电子学习资料,CRM 2013中的沙箱插件只有30秒而不是120秒。 I haven't tested that out yet. 我还没有测试过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM