在 app.UseStaticFiles(); 后面加上

app.UseStaticFiles(new StaticFileOptions
            {
                //FileProvider = new PhysicalFileProvider(Directory.GetCurrentDirectory()),
                //设置不限制content-type 该设置可以下载所有类型的文件,但是不建议这么设置,因为不安全
                //下面设置可以下载apk和nupkg类型的文件
                ContentTypeProvider = new FileExtensionContentTypeProvider(new Dictionary<string, string>
                {
                      { ".apk", "application/vnd.android.package-archive" }
                })
            });

 

相关文章:

  • 2021-10-10
  • 2021-04-08
  • 2022-01-26
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
猜你喜欢
  • 2022-02-08
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
  • 2021-10-24
相关资源
相似解决方案