SharePoint服务器对象模型多线程问题 [英] SharePoint server object model multi-threading issues

查看:96
本文介绍了SharePoint服务器对象模型多线程问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有C#的SharePoint服务器对象模型,并且在使用sharepoint服务器对象模型创建多线程应用程序时遇到问题。



我有两种类型的工作,第一种作业类型涉及读取SharePoint文档库中的数据,第二种类型涉及将数据写入文档库。



当我在多个线程中处理多个数据读取作业时,一切正常。但是当我在多个线程中处理多个数据写入作业时,应用程序会在一段时间后冻结。



我知道SharePoint服务器对象模型中的所有实例方法都不是线程安全的。但是多线程似乎可以在数据读取作业中正常工作,它只会在涉及数据写入作业时引发问题。我检查了线程并冻结了对象模型API调用。



有没有安全的方法来使用sharepoint服务器对象模型实现多线程应用程序。

I am using SharePoint server object model with C# and having problems creating multi-threaded application using sharepoint server object model.

I have two types of jobs, first job type involve reading data in SharePoint document library and second type involve writing data to document library.

When i process multiple data reading jobs in multiple threads all goes fine. But when i process multiple data writing jobs in multiple threads then application freezes after some time.

I know all instance methods in SharePoint server object model are not thread safe. But multi threading seems to work fine with data reading jobs, it only causes issues when data writing jobs are involved. I have checked the threads and they freeze on object model API calls.

Is there any safe way to implement multi threaded application using sharepoint server object model.

推荐答案

Just想一想,SharePoint会在DB Write期间锁定表,因此您可能希望在将数据写入文档库时实现信号量或互斥量。



我即将创建自己的MT SharePoint解决方案,这就是我设计我的方法。
Just a thought, SharePoint locks the Table during DB Write, so you may want to implement a Semaphore or Mutex at the point where you are writing data to the Document Library.

I am about to create my own MT SharePoint solution, and that is how I am designing mine.


这篇关于SharePoint服务器对象模型多线程问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆