我有个问题。
我有一个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);
}
}
}
}Code 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
发布于 2011-03-22 21:05:32
您是否在web配置中设置了最大文件长度?
<system.web>
<httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>https://stackoverflow.com/questions/5391579
复制相似问题