我有一个问题。
我有一个正在运行的 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/