把apk 文件放到网站的wwwroot目录
1.
IIS设置MIME类型
添加.apk, MIME类型:application/vnd.android.package-archive
2.
然后StarUp下添加允许类型,即可
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
//FileProvider = new PhysicalFileProvider(Directory.GetCurrentDirectory()),
//设置不限制content-type 该设置可以下载所有类型的文件,但是不建议这么设置,因为不安全
//ServeUnknownFileTypes = true
//下面设置可以下载apk和nupkg类型的文件
ContentTypeProvider = new FileExtensionContentTypeProvider(new Dictionary<string, string>
{
{ ".apk","application/vnd.android.package-archive"},
{ ".nupkg","application/zip"}
})
});