I have an issue uploading large files in the MVC.NET Core application. No matter what I do I get back a 404 no data response
Here is my task method that uploads file
        [RequestSizeLimit(40000000)]
    public static async Task<string> UploadAttachment(string bis232JsonString, string url, string formType, string token, long maxResponseContentBufferSize)
    {
        var result = "Error";
        try
        {
            // To Do : Use ConfigurationManager.AppSettings["endpoint"];
            string endpoint = $"{url}/{formType}Attachment/post";
            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                //client.MaxResponseContentBufferSize = maxResponseContentBufferSize;
                using (var request = new HttpRequestMessage(HttpMethod.Post, endpoint))
                {
                    request.Content = new StringContent(bis232JsonString, Encoding.UTF8, "application/json");
                    using (var response = await client.SendAsync(request))
                    {
                        if (response.IsSuccessStatusCode && (response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.NoContent))
                            result = "Success";
                        else
                            result = "Error";
                    }
                }
            }
        }
        catch (Exception ex)
        {
            //to do : Log application error properly
            result = "Error";
        }
        return result;
    }
I tried the following
- Tried to use MaxResponseContentBufferSize property of HTTP Client
 - Tried to use [RequestSizeLimit(40000000)] decorator
 - Tried to use [DisableRequestSizeLimit] decorator
 Tried to update the upload limit globally as shown below
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .UseKestrel(options => { options.Limits.MaxRequestBodySize = 52428800; });
However, no matter what I try to do, nothing seems to work
Please let me know if there is anything that could be done to make it work