Web 服务器找不到 .mtl 文件
web server cannot find .mtl file
因此,我使用 THREE.js 和 .obj 和 .mtl 文件在网页上显示 3D 模型。这在开发过程中一直运行良好,并且在 Brackets 的实时预览本地服务器上运行良好。但是,一旦我通过 FTP 将文件上传到真实的 Web 服务器并尝试加载页面,我就会在控制台中收到此错误:
http://jacksteel.azurewebsites.net/Models/Aventador/Avent.mtl Failed to load resource: the server responded with a status of 404 (Not Found).
通过 FileZilla 仔细检查文件本身肯定在它应该在的地方。
除非我遗漏了一些东西,否则我认为这没有理由不起作用,对吗?
http://jacksteel.azurewebsites.net/Models/Aventador/Avent.mtl Failed to load resource: the server responded with a status of 404 (Not Found).
我可以重现这个问题。
要解决此问题,请尝试配置元素以在 Web.config.
中添加 .mtl MIME 类型
<system.webServer>
<staticContent>
<remove fileExtension=".mtl" />
<mimeMap fileExtension=".mtl" mimeType="text/plain" />
</staticContent>
</system.webServer>
因此,我使用 THREE.js 和 .obj 和 .mtl 文件在网页上显示 3D 模型。这在开发过程中一直运行良好,并且在 Brackets 的实时预览本地服务器上运行良好。但是,一旦我通过 FTP 将文件上传到真实的 Web 服务器并尝试加载页面,我就会在控制台中收到此错误:
http://jacksteel.azurewebsites.net/Models/Aventador/Avent.mtl Failed to load resource: the server responded with a status of 404 (Not Found).
通过 FileZilla 仔细检查文件本身肯定在它应该在的地方。 除非我遗漏了一些东西,否则我认为这没有理由不起作用,对吗?
http://jacksteel.azurewebsites.net/Models/Aventador/Avent.mtl Failed to load resource: the server responded with a status of 404 (Not Found).
我可以重现这个问题。
要解决此问题,请尝试配置元素以在 Web.config.
中添加 .mtl MIME 类型<system.webServer>
<staticContent>
<remove fileExtension=".mtl" />
<mimeMap fileExtension=".mtl" mimeType="text/plain" />
</staticContent>
</system.webServer>