Hello, I am experimenting with the .NET SDK, and I would like to send large IFC files (321MB) to Speckle. How can I achieve this?
When I send smaller IFC files, it works correctly, but when I want to send larger data, I get the following error: An existing connection was forcibly closed by the remote host.
string endpoint = "https://app.speckle.systems/api/file/autodetect/bbe2e198ff/test";
string filepath = "D:/Speckle/IFC/KNR-K-E-XX-3D-XXX-100-KNORR BREMSE CENTRAL (33).ifc";
string token = "91fe7fe8e47aeb4daef95a7ab01df07662e964d31a";//"ac7f250a838152dd69b538f08f6eef8cf125af7fa8";
using (var httpClient = new HttpClient())
{
using (var formData = new MultipartFormDataContent())
{
using (var fileStream = new FileStream(filepath, FileMode.Open, FileAccess.Read))
{
formData.Add(new StreamContent(fileStream), "file", Path.GetFileName(filepath));
httpClient.DefaultRequestHeaders.Add("Authorization", token);
httpClient.Timeout = new TimeSpan(1, 15, 0);
var response = await httpClient.PostAsync(endpoint, formData);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
_logger.LogInformation(content);
return Ok(content);
}
else
{
var errorResponse = await response.Content.ReadAsStringAsync();
_logger.LogInformation(errorResponse);
return BadRequest(errorResponse);
}
}
}
}