背景:  最近在研究web3d,使用了three.js前端框架来实现的,前端显示的3D模型是由blender软件导出的.glb文件,我把.glb文件放在www.root中时,在前端调用时显示404。

解决办法:

           FileExtensionContentTypeProvider 类包含 Mappings 属性,用作文件扩展名到 MIME 内容类型的映射。

 app.UseStaticFiles(new StaticFileOptions
            { 
                ContentTypeProvider = new FileExtensionContentTypeProvider(new Dictionary<string, string>
            {
                    { ".glb", "model/gltf-binary" }
              })
            });

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-24
  • 2021-12-21
  • 2021-11-27
  • 2021-09-28
  • 2021-07-15
猜你喜欢
  • 2021-10-25
  • 2022-12-23
  • 2021-09-10
  • 2021-07-24
相关资源
相似解决方案