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

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

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

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

原文地址:https://www.cnblogs.com/h82258652/p/9524992.html