Unexpected end of Stream when uploading to aspnet core

We’ve been struggling the last week with several issues after moving our api to dotnet core. One of those has shown up when trying to POST a file.

It’s a simple endpoint expecting the standard multipart/form-data upload. However, we get the following error now.

{"responseStatus":{"errorCode":"IOException","message":"Unexpected end of Stream, the content may have already been read by another component. ","stackTrace":"   at Microsoft.AspNetCore.WebUtilities.MultipartReaderStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)\n   at Microsoft.AspNetCore.WebUtilities.StreamHelperExtensions.DrainAsync(Stream stream, ArrayPool`1 bytePool, Nullable`1 limit, CancellationToken cancellationToken)\n   at Microsoft.AspNetCore.WebUtilities.MultipartReader.ReadNextSectionAsync(CancellationToken cancellationToken)\n   at Microsoft.AspNetCore.Http.Features.FormFeature.InnerReadFormAsync(CancellationToken cancellationToken)\n   at Microsoft.AspNetCore.Http.Features.FormFeature.ReadForm()\n   at ServiceStack.Host.NetCore.NetCoreRequest.get_FormData()\n   at ServiceStack.HttpRequestExtensions.GetFlattenedRequestParams(IRequest request)\n   at ServiceStack.Host.RestHandler.CreateRequestAsync(IRequest httpReq, IRestPath restPath)\n   at ServiceStack.Host.RestHandler.ProcessRequestAsync(IRequest req, IResponse httpRes, String operationName)"}}

The only thing we could find is this. It doesn’t really pertain since we’re not using mvc here but servicestack.