我有一个问题。
我正在运行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);
Code 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>
/Göran
答案 0 :(得分:0)
您是否在网络配置中设置了最大文件长度?
<system.web>
<httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>