首页 新闻 会员 周边 捐助

调用腾讯云对象存储Web API总是报错"ERROR_CGI_PARAM_NO_SUCH_OP"

0
悬赏园豆:50 [已解决问题] 解决于 2017-11-12 13:41

在 .NET Core 中调用腾讯云对象存储(COS)Web API,对应的主要 C# 代码如下:

复制代码
var path = HttpUtility.UrlPathEncode(remotePath.TrimStart('/'));
var url = $"{BASE_ADDRESS}{_cosClientOptions.AppId}/{bucketName}/{path}";
var signature = GenerateSignature(bucketName, remotePath);
var boundary = "---------------" + DateTime.Now.Ticks.ToString("x");
var fileName = Path.GetFileName(remotePath);

var request = new HttpRequestMessage(HttpMethod.Post, url);
request.Headers.Authorization = new AuthenticationHeaderValue("Authorization", signature);
var data = new MultipartFormDataContent(boundary);
data.Add(new ByteArrayContent(Encoding.UTF8.GetBytes("upload")), "op");
data.Add(new StreamContent(uploadStream), "fileContent", fileName);
request.Content = data;

var response = await _httpClient.SendAsync(request);
复制代码

调用时总是报下面的错误:

{"code":-5964,"message":"ERROR_CGI_PARAM_NO_SUCH_OP","request_id":"NWEwMmMwOTVfYzdhMDY4NjRfMjM3OWNfMjQ1OTNj"}

请问如何解决?

dudu的主页 dudu | 高人七级 | 园豆:29568
提问于:2017-11-08 17:00
< >
分享
最佳答案
0
dudu | 高人七级 |园豆:29568 | 2017-11-12 13:41
其他回答(1)
0
收获园豆:50
MrNice | 园豆:3468 (老鸟四级) | 2017-11-08 17:27
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册