我上传的文件是55MB。允许的最大文件大小为49MB。我的代码是:
private void AddFilePartToVault(FileInfo fileInfo, long folderId,
WebServiceManager manager)
{
Guid guid = Guid.Empty;
using(FileStream stream = new FileStream(fileInfo.FullName,
FileMode.Open,FileAccess.Read))
{
ByteArray array = new ByteArray();
array.Bytes= new byte[MaxFileSize];
long unreadBytes;
while ((unreadBytes = stream.Length-stream.Position)>0)
{
if (unreadBytes < MaxFileSize)
array.Bytes=new byte[unreadBytes];
stream.Read(array.Bytes,0,array.Bytes.Length);
try
{
guid = manager.DocumentService.UploadFilePart(guid, array);
}
catch (System.Net.WebException we)
{
MessageBox.Show(we.Message);
}
}
使用此功能,上传第二部分6MB,不上传第一部分49MB。引发异常Http状态404未找到。