wcf - 将较大的文件 (200MB) 上传到保管箱

标签 wcf web-services dropbox

我有一个问题。

我有一个正在运行的 WCF。这个想法是该服务将文件(200MB)上传到 DropBox 帐户。

我试过 SharpBox 和 DropNet。在我尝试上传文件之前,一切都很顺利。 这意味着登录 Dropbox 并创建文件夹可以,但上传不起作用...

这是我目前尝试过的:

代码 sharpBox 方式 1:

ICloudFileSystemEntry file = _storage.CreateFile(_folderEntry, Path.GetFileName(fileToUpload));

using (FileStream fileStream = new FileStream(fileToUpload, FileMode.Open, FileAccess.Read))
    {

Int32 length = 1024;
    int bytesRead = 0;
    Byte[] buffer = new Byte[length];

    using (Stream data = file.GetContentStream(FileAccess.Write))
    {

        using (BinaryWriter writer = new BinaryWriter(data))
        {

            bytesRead = fileStream.Read(buffer, 0, length);
            // write the required bytes
            while (bytesRead > 0)
            {
                bytesRead = fileStream.Read(buffer, 0, length);
                writer.Write(buffer, 0, bytesRead);
            }

        }
    }
}

代码 sharpBox 方式 2:

_storage.UploadFile(fileToUpload, _folderEntry);

编码 DropNet 方式 3:

byte[] content = _client.GetFileContentFromFS(new FileInfo(fileToUpload)); 
_client.UploadFile(_dropBoxFolder, Path.GetFileName(fileToUpload), content);

在网络配置中:

<httpRuntime maxRequestLength="2097151" executionTimeout="3600" />

<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="2147483648"/>
  </requestFiltering>
</security>

/跃然

最佳答案

您是否在网络配置中设置了最大文件长度?

<system.web>
  <httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>

关于wcf - 将较大的文件 (200MB) 上传到保管箱,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5391579/

相关文章:

c# - 需要避免数字签名公共(public)证书 BinarySecurityElement 被 mtom 编码

rest - 如何将 PATCH 方法与 CL_REST_HTTP_CLIENT 一起使用?

JAVA-EE Tomcat Axis2 - 设置和项目构建

java - 具有可配置凭据的 Spring WebServiceClient

c# - 获取本地保管箱同步状态

python - 如何以编程方式确定 Dropbox 文件夹位置?

c# - 共享字典的 WCF 方法

c# - 使用代码添加 WCF 服务行为

c# - C# 对象中 [key] 的用途是什么?

java - 如何在 Android 中从/向 Dropbox 导出导入 SQLite 数据库?