Hi,
I have a problem with uploading DICOM files with the “/instances” API.
When posted from Postman everything works well.
When posted used from my own code, I get a response 200, but not response content and no actual effect (file is not really uploaded).
I am trying to debug the issue, and would like to know if there is a way to understand what is being received/happening on the Orthanc side.
I am using Orthanc in docker.
turning on --verbose does not produce any logging for rest API calls.
Is there a way to enable such logging?
The code I am using for the upload is:
internal async Task<Dictionary<string, bool>> UploadToLocalPacs(List files)
{
var filesResultStatus = new Dictionary<string, bool>();
using (var client = new HttpClient())
{
foreach (var file in files)
{
filesResultStatus[file.FileName] = false; // by default - not saved unless successful
try
{
if (file.Length > 0)
{
using (var content = new MultipartFormDataContent())
{
content.Add(new StreamContent(file.OpenReadStream())
{
Headers =
{
ContentLength = file.Length,
ContentType = new MediaTypeHeaderValue(file.ContentType),
},
}, “File”, file.FileName);
var result = await client.PostAsync(OrthancClient.BaseUrl + “/instances”, content);
var resultContent = await result.Content.ReadAsStringAsync();
if (result.StatusCode == System.Net.HttpStatusCode.OK)
{
filesResultStatus[file.FileName] = true;
}
else
{
_log.Warning(“UploadToLocalPacs: files uploading file: ‘{}’”, content);
}
}
}
}
catch (Exception ex)
{
_log.Error(ex, “UploadToLocalPacs: Error uploading file”);
}
}
}
return filesResultStatus;
Thank you very much!
Gil