APK packages is not served in ASP.NET Core MVC

妖精的绣舞 提交于 2019-12-05 11:11:39

The ASP.NET Core Static files middleware apparently doesn't serve files which don't have a mapping to a MIME type in the ContentTypeProvider. To solve this, you should add the MIME mapping to the ContentTypeProvider:

    FileExtensionContentTypeProvider contentTypes = new FileExtensionContentTypeProvider();
    contentTypes.Mappings[".apk"] = "application/vnd.android.package-archive";
    app.UseStaticFiles(new StaticFileOptions
    {
        ContentTypeProvider = contentTypes
    });

Now the .apk will be served.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!