Hello! 🐒
I'm trying to download all the files that a search query on content server returns.
Basically for every file that's returned, I'm calling the API to get the content and save it.
However, in a test-case where I want to download 90 files, it always crashed at file #65 with the error message:
{"An error occurred while sending the request."}
{"The server committed a protocol violation. Section=ResponseStatusLine"}
*workaround implemented* (<httpWebRequest useUnsafeHeaderParsing="true" />
)
{"Error while copying content to a stream."}
"Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."
The next 25 files work normally after that. When i download again (skipping all the files that are already there) file #65 downloads normally too.
Is there a setting on Content Server OR IIS that might help me in this situation?
Please give this ticket to someone with coding knowledge (preferably in C#) to look over it together.
Because most of the files work, i think the problem is either CS or its WebServer (IIS).
Thanks in advance! I'm looking forward to talking with you! :)
Code to download 1 files (inside forach-loop):
string completeURLFolder = string.Format("{0}/v2/nodes/{1}/content", configObject.config.baseURL, nodeID);
var responseFolderSearch = config.GetInstance().httpClient.GetAsync(completeURLFolder).Result;
//CRASHES HERE!
if (responseFolderSearch.IsSuccessStatusCode)
{
//Save downloaded Content
Byte[] responseByteArray = responseFolderSearch.Content.ReadAsByteArrayAsync().Result;
File.WriteAllBytes(filepath, responseByteArray);
//using(Stream input = responseFolderSearch.Content.Respon)
pbDownloadStatus.Value = row.Index + 1;
downloadedDocs += 1;
lblDownloadStatus.Text = String.Format("{0} von {1} Dokumenten verarbeitet", row.Index + 1, dgvResults.Rows.Count);
writeLog(String.Format("INFORMATION_{0}:Dokument mit Namen {1} wurde erfolgreich im Pfad {2} angelegt", DateTime.Now.ToString(), filename, filepath));
}