我正在尝试将一些模型上传到 Autodesk Forge 数据管理 API。不幸的是,模型大小超过 1GB,API 给出了超时异常:
状态码:504,原因短语:'GATEWAY_TIMEOUT'
使用以下代码(C#):
var url = $"https://developer.api.autodesk.com/oss/v2/buckets/{bucketKey}/objects/{objectName}";
using (var httpClient = GetAuthorizedHttpClient("data:write"))
{
httpClient.Timeout = TimeSpan.FromMinutes(120);
var request = new HttpRequestMessage(HttpMethod.Put, url);
fileStream.Position = 0;
request.Content = new StreamContent(fileStream);
var response = httpClient.SendAsync(request).Result;
var responseContent = response.Content.ReadAsStringAsync().Result;
if (!response.IsSuccessStatusCode)
throw new Exception($"Failed to upload object: {response.ReasonPhrase}");
var result = JsonConvert.DeserializeObject<ObjectUploadResult>(response.Content.ReadAsStringAsync().Result);
return result;
}
你有什么建议吗?提前致谢!