远程服务器返回错误:(411)每当我设置SendChunked = true时都需要长度

时间:2018-08-16 11:23:30

标签: asp.net object-storage oracle-cloud-infrastructure

我尝试在oracle云基础结构上上传,但是每当设置SendChunked = true时都会抛出错误411,但是在删除所有内容后一切正常。我想要实现SendChunked = true,因为我想分块上传数据。 br /> 请查看代码并查找错误。

ServicePointManager.SecurityProtocol =  SecurityProtocolType.Tls12;

FileStream rdr = new FileStream(fileToUpload, FileMode.Open, FileAccess.Read);

var uri = new Uri($"https://objectstorage.us-phoenix-1.oraclecloud.com/n/{Namespace}/b/{bucket}/o/gradetest ");

var request = (HttpWebRequest)WebRequest.Create(uri);             
request.SendChunked = true;           
request.Method = "PUT";            
request.Accept = "application/json";
request.ContentType = "application/zip";           
request.KeepAlive = false;
request.Timeout =600000;
request.ContentLength = rdr.Length;
request.AllowReadStreamBuffering = false;
request.AllowWriteStreamBuffering = false;

0 个答案:

没有答案