简体   繁体   English

上载具有Dropnet问题的大文件

[英]Upload large files with Dropnet issue

I'm using Dropnet library in Visual Studio 2010 and I've connected my project with Dropbox. 我正在Visual Studio 2010中使用Dropnet库,并且已将我的项目与Dropbox连接。 When I try to use upload with files smaller than 4MB it's ok but when the files are larger there is a problem. 当我尝试使用小于4MB的文件上传时,可以,但是当文件较大时,出现问题。 I've searched and found a sollution, to add this code in web.config: 我搜索并找到了解决方法,可以在web.config中添加以下代码:

<system.web> 
  <httpRuntime executionTimeout="1000" maxRequestLength="104857600"/> 
</system.web> 

and this: 和这个:

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="104857600"/>
    </requestFiltering>
  </security>
</system.webServer>

So this should allow me to upload files smaller than 100MB, I've succeeded with some files around 10MB but when I try around 50MB and smaller, somehow it gets stuck, no error or anything, and no matter what number I put in maxRequestLength and maxAllowedContentLength it's still the same. 因此,这应该允许我上传小于100MB的文件,我已经成功处理了大约10MB的文件,但是当我尝试将50MB或更小的文件上传时,无论如何它都会卡住,没有错误或发生任何事情,无论我在maxRequestLength和maxAllowedContentLength仍然相同。 Please help. 请帮忙。 My code is: 我的代码是:

if (filMyFile.PostedFile!=null)
  {
     Stream stream = filMyFile.PostedFile.InputStream;
     int sLen = filMyFile.PostedFile.ContentLength;
     byte[] binaryData = new byte[sLen];
     int n = stream.Read(binaryData, 0, sLen);
     _client.UploadFile("/Folder/", filMyFile.PostedFile.FileName, binaryData);
  }

The UploadFile method returns a DropNet.Models.MetaData. UploadFile方法返回一个DropNet.Models.MetaData。 In my experience, if the upload is not successful, then the UploadFile method returns null. 以我的经验,如果上传不成功,则UploadFile方法将返回null。 If the call is successful, then it returns an object. 如果调用成功,则返回一个对象。

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

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