解决 asp.net core 中下载 exe 文件返回 404

在 StartUp 中的 Configure 方法添加以下代码便可app

app.UseStaticFiles(new StaticFileOptions()
{
    ContentTypeProvider = new FileExtensionContentTypeProvider()
    {
        Mappings = {[".exe"] = "application/octect-stream"}
    }
});

缘由是默认没有 exe 的 content-type。ide

相关文章
相关标签/搜索