SharePoint 2016 error 500 (internal server error)

Michel AL HAYEK 147 Reputation points
2021-03-13T13:19:53.183+00:00

Hello Everyone, i am facing an issue with Sp16 when i upload many documents using rest API. when i upload many documents each one is 20mb i am receiving error 500 Internal server error.
any idea about this error and how to solve it?
i tried this https://www.vioreliftode.com/index.php/how-to-make-sharepoint-2016-not-fail-long-running-uploads-large-files/ but it didn't work for me. any other suggesstions?
my post request is below

public async Task<bool> Save(string requestUri, HttpContent content)
        {
            var credential = new System.Net.NetworkCredential(
                username,
                password,
                domain);



            using (var handler = new HttpClientHandler() { Credentials = credential, UseProxy = false })
            {
                using (var client = new HttpClient(handler))
                {
                    client.DefaultRequestHeaders.Accept.Clear();



                    var mediaType = new MediaTypeWithQualityHeaderValue("application/json");



                    mediaType.Parameters.Add(new NameValueHeaderValue("odata", "nometadata"));



                    client.DefaultRequestHeaders.Accept.Add(mediaType);



                    client.DefaultRequestHeaders.Add("X-RequestDigest", await this.GetRequestDigest());
                    client.DefaultRequestHeaders.Add("binaryStringRequestBody", "true");



                    string postUrl = this.siteUrl.EndsWith("/") ? $"{this.siteUrl}{requestUri}" : $"{this.siteUrl}/{requestUri}";
                    this.logger.LogDebug("Executing SharePointService.Save: PostUrl={0}.", postUrl);



                    HttpResponseMessage response = await client.PostAsync(postUrl, content);



                    response.EnsureSuccessStatusCode();



                    this.logger.LogDebug("Executed SharePointService.Save: PostUrl={0}", postUrl);



                    return true;
                }
            }
        }
Microsoft 365 and Office | SharePoint Server | Development
0 comments No comments

1 answer

Sort by: Newest
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    4 deleted comments

    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.