当Android 文件 Apk 放在Asp.net core wwwroot 虚拟目录下面、访问是 404,设置Content-Type类型

app.UseStaticFiles();

            //设置实际目录与虚拟目录  
            app.UseStaticFiles(new StaticFileOptions
            {
                FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot/Files")),
                RequestPath = new PathString("/jfiles"),
             
                //设置Android APK 下载
                ContentTypeProvider = new FileExtensionContentTypeProvider(new Dictionary<string, string>
                {
                    { ".apk","application/vnd.android.package-archive"},
                    { ".nupkg","application/zip"}
                })
            });

 

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

 

相关文章:

  • 2021-09-18
  • 2021-09-17
  • 2021-10-08
  • 2022-01-14
  • 2021-07-25
  • 2021-12-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-12
  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案