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

在 StartUp 中的 Configure 方法添加如下代码即可

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

原因是默认没有 exe 的 content-type。

posted @ 2018-08-23 17:11  h82258652  阅读(1361)  评论(0编辑  收藏  举报