3

私は問題があります。

私は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);

webconfig で:

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

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

/ゴラン

4

1 に答える 1

0

Web構成で最大ファイル長を設定しましたか?

<system.web>
  <httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>
于 2011-03-22T13:05:32.337 に答える