I need to upload large files using a ServiceStack Service, hosted on an AspNetCore 5.0 application. Attempting to usethe AspNetMvc attribute doesn't work.
[Route("/api/tehformz", "POST")]
public class BigFileUploadRequest {
public string Name { get; set; }
public string Description { get; set; }
public string DeviceTypeId { get; set; }
}
[RequestSizeLimit(300 * 1024 * 1024)]
public ResponseStatus Post(BigFileUploadRequest request) {
...
}
I've tried adding a MiddleWare handler like below. It is executed, but not honored.
private async Task FallbackMiddlewareHandler(HttpContext httpContext, Func<Task> next)
{
httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = null;
await next();
}
It might be worth noting I am posting the file as form data, and it works fine for smaller uploads.
How do I update my middle ware or decorate my service call so I can upload files larger than AspNetCore's ~30MiB limit?