CRM 2011 工作流程“无效指针”错误
我在 CRM 2011 中有一个自定义工作流程,它是根据自定义实体记录手动触发的。当选择单个记录进行处理时,工作流始终会成功。但是,当选择多条记录时,至少有一条会失败。即使使用相同的数据,每次尝试提供的错误似乎也有所不同。
到目前为止我遇到的错误是:
- ValidateOpen - Encountered Disposeed CrmDbConnection when it should 无法从另一个
- 尚未调用 OnBeginRequest 的 SqlExecutionContext
创建 SqlExecutionContext重新启动数据库服务器后:
- 无效指针
所有这些都会在调用 IOrganizationService 的 Update 方法时发生。无效指针错误似乎是重新启动数据库服务器后更常见的错误(有人向我建议这可能是数据库服务器过于繁忙的问题)。我还删除了所有积压的异步任务,以防这是问题所在,但它没有任何效果。
有谁知道这个错误意味着什么,为什么我可能会收到它或者我如何解决这个问题?
非常感谢!
I have a custom workflow in CRM 2011 which is manually triggered against custom entity records. When a single record is selected for processing, the workflow is always successful. However when selecting more than one record, at least one will fail. The error(s) provided seem to vary from one attempt to the next, even though the same data is being used.
Errors I've encountered so far are:
- ValidateOpen - Encountered disposed CrmDbConnection when it should
not be disposed You cannot create a SqlExecutionContext from another - SqlExecutionContext on which OnBeginRequest has not been called
And after restarting the DB server:
- Invalid Pointer
All of these occur when calling the Update method of the IOrganizationService. The Invalid Pointer error seems to be the more common error since having restarted the DB server (it was suggested to me that it might be an issue with an overly-busy DB server). I've also deleted any backlog of asynchronous tasks in case this was the issue, but it hasn't had any effect.
Does anyone know what this error means, why I might be getting it or how I can get around the issue?
Many thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这条错误消息似乎是一种迂回的说法,“在前一个连接打开时尝试打开另一个与 CRM 的连接”,并且它尝试执行此操作的原因与事实上,它仅在处理多个记录时才会失败。
参考此博客:
似乎当工作流针对多个记录运行时,它使用类的相同实例,这意味着类级变量不会在执行之间重新实例化。因此,当后续执行到将类级服务变量设置为 IOrganizationService 实例的代码时,它会发现变量已经有一个并且它是打开的。
我发现最容易实现的解决方案是在执行函数中包含服务变量,而不是在类级别。从那时起,这已经解决了我尝试过的所有问题。
It seems this error message is a round-about way of saying, 'tried to open another connection to CRM when the previous one was open', and the reason it tries to do this is very much relevant to the fact it only fails when processing more than one record.
Reference this blog:
It seems that when a workflow is run against multiple records, it uses the same instance of the class, which means that class-level variables won't be re-instantiated between executions. So, when subsequent executions come to the code which sets the class-level service variable to an instance of an IOrganisationService, it finds the variables already has one and that it's open.
The solution I've found easiest to implement it to have the service variable within the Execute function, rather than class-level. This has solved the problem everywhere that I've tried it since.
根据 CRM 2011 Web 服务错误代码...
InvalidPointer -对象被处置。
According to the CRM 2011 Web Service Error Codes...
InvalidPointer - The object is disposed.