无法通过SharePoint 2013中的CMIS API上传大于37 MB的文档

时间:2016-04-14 09:46:19

标签: file-upload sharepoint-2013 large-files opencmis apache-chemistry

我的SharePoint 2013版本是15.0.4569.1506。我无法通过以下CMIS代码在SharePoint上传大于37 MB的文档。但直接进入SharePoint我能够这样做。我也尝试过增加堆大小/缓存限制。我得到一个异常 - 'CmisRuntimeException:Found'

Folder someFolder = (Folder) session.getObjectByPath("/TestFolder");

File file = new File("C:/Users/Administrator/Desktop/50MBFile.zip"); 
String fileName = file.getName();

Map<String, Object> props = new HashMap<String, Object>();
props.put("cmis:objectTypeId", "cmis:document");
props.put("cmis:name",fileName);

String mimetype = "application/octet-stream";

ContentStream contentStream = session.getObjectFactory().createContentStream(fileName,
    file.length(),
    mimetype,
    new FileInputStream(file));

VersioningState versioningState = null;

Document someDoc = someFolder.createDocument(props, contentStream, versioningState );

我使用过AtomPub Binding。我的代码或我需要更改的任何其他SharePoint / CMIS设置有问题吗?

线程“main”中的异常org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException:Found  at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:487)  at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:629)  at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:119)  在org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:751)  在org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:95)  在org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:469)  在UploadLargeFile.main(UploadLargeFile.java:31)

此第31行对应于“Document someDoc = someFolder.createDocument(props,contentStream,versioningState);”

1 个答案:

答案 0 :(得分:1)

检查3个位置的web.config文件中允许的最大限制:

要解决此问题,您需要在TARGET服务器场的三个位置增加maxRequestLength值:

  • 管理中心web.config文件(通常位于C:\ Inetpub \ wwwroot \ wss \ VirtualDirectories \ DirectoryName)

  • 您的Web应用程序主web.config文件(通常位于C:\ Inetpub \ wwwroot \ wss \ VirtualDirectories \ DirectoryName)。

  • 内容部署web.config文件位于: C:\ Program Files \ Common Files \ Microsoft Shared \ Web Server Extensions \ 15 \ TEMPLATE \ ADMIN \ Content Deployment

打开位于每个位置的web.config文件,找到maxRequestLength属性。增加它以允许上传您拥有的最大CAB文件。默认设置将上载文件大小限制为CA和Web应用程序的51200 KB,以及内容部署的102400 KB。

<configuration>
  <system.web>
    <httpRuntime maxRequestLength=”102400″ />
  </system.web>
</configuration>