Asp.net Core中的ReadAsMultipartAsync

问题描述

我想在asp.net核心中使用resumable.js,但是某些代码在.net核心中不起作用,例如:

private async Task<bool> readPart(MultipartFormDataStreamProvider provider)
{
    try
    {

        await  Request.Content.ReadAsMultipartAsync(provider);

        ResumableConfiguration configuration = GetUploadConfiguration(provider);
                int chunkNumber = GetChunkNumber(provider);

        // Rename generated file
        multipartfileData chunk = provider.FileData[0]; // Only one file in multipart message
                RenameChunk(chunk,chunkNumber,configuration.Identifier);

        // Assemble chunks into single file if they're all here
        TryAssembleFile(configuration);
                return true;
    }
    catch 
    {
        return false;
    }
}

如何更改Request.Content.ReadAsMultipartAsync以在.net核心中使用?

ResumableController.cs

解决方法

根据开发人员的要求,此扩展名已针对.net核心进行了更新。在github上查看此issue

只需下载此nuget软件包,即可使用扩展名:

Microsoft.AspNet.WebApi.Client