I am using ASP.NET Core 1.1. and I am trying to upload files using JQuery AJAX but I keep getting the error: "Multipart body length limit 16384 exceeded"
Reseach told me to add this to my Startup.js file:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.Configure<FormOptions>(Option =>
{
Option.MultipartBodyLengthLimit = 200000000;
});
}
But I still keep getting the error at
foreach (File file in Request.Form.Files)
I see that that the MultipartBodyLengthLimit is updated at startup but it doesn't seem to hold the updated value somehow when the app runs.
Does this even work in ASP.NET Core or do I need to use another way to upload files using jQuery in ASP.NET Core?