1、在Startup.cs的Configure方法中添加如下代码
代码语言:javascript复制var provider = new FileExtensionContentTypeProvider();
provider.Mappings.Add(".apk", "application/vnd.android.package-archive");
app.UseStaticFiles(new StaticFileOptions
{
ContentTypeProvider = provider,
FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(System.IO.Directory.GetCurrentDirectory() @"/App"),
RequestPath = $ "/项目名称/App" // 存放APP的文件夹
});
2、IIS-添加.apk的MIME类型
1)单击IIS上右击所建网站,选择MIME类型
2)点击MIME类型,点击添加
文件扩展名:.apk MIME类型:application/vnd.android.package-archive
注意:app的文件要设置属性为:始终复制