I am getting the following when Trying to upload a video file larger than 15 seconds for a form,
The video model is as follow,
public class VideoUploadViewModel
{
[Required]
[Display(Name = "Video File")]
public IFormFile VideoFile { get; set;}
public string VideoFileName { get; set; }
public string InferenceModelType { get; set; } = "Body25";
public string OriginalVideoFilePath { get; set; }
public string OverlayVideoFilePath { get; set; }
}
also,
I am using the form to upload a file,
@Html.TextBoxFor(m => m.VideoFile, new {type = "file", @class = "form-control"})
I tried using the following method to increase the limit,
builder.WebHost.ConfigureKestrel(options =>
{
options.Limits.MaxRequestBodySize = 512 * 1024 * 1024;
});
builder.Services.Configure<FormOptions>(options =>
{
options.MultipartBodyLengthLimit = 512 * 1024 * 1024;
});
But still I am not able to upload large files.
Cannot figure it out in .NET 7,also there is no web.config created when I create a new project using Visual Studio.
Try the below code in your Program.cs:
IIS content length limit
The default request limit (maxAllowedContentLength) is 30,000,000 bytes, which is approximately 28.6MB. Customize the limit in the web.config file(you can custom create a web.config file):