问题描述
我使用three.js for webGL 加载.obj但是在运行 Windows Server 2008 的 Windows Azure 中加载 .obj 时遇到问题我使用 Google chrome 浏览器,出现以下错误:
I am using three.js for webGL to load .objbut I have a problem when loading .obj in Windows Azure runnning Windows Server 2008I using Google chrome browser and it gives the error below:
GET http://websiteaddress.net/webGL/obj/test.mtl404(未找到)
GET http://websiteaddress.net/webGL/obj/test.mtl 404 (Not Found)
甚至,我使用他们的原始源代码加载 .obj 文件它也有同样的错误
even, I used their original source code to load .obj file it has the same error
当我尝试浏览服务器中的其他图像文件时,我可以预览它例如:(website.net/images/test.gif) - 我可以在浏览器中看到 test.gif 图像
and when i try to navigate other images file in the server i can preview iteg: (website.net/images/test.gif) - i can see the test.gif image in the browser
但是当我导航到 .obj 时,我在浏览器中收到错误:(例如:website.net/obg/test.obj)
but when i navigate to .obj, i receive error in the browser:(eg : website.net/obg/test.obj)
404 - 未找到文件或目录.您要查找的资源可能已被删除、更名或暂时不可用.
404 - File or directory not found.The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
我可以在本地查看我的 .obj 但当我将其放入 Azure 时则无法查看!任何人都可以帮助我吗?谢谢!
i can view my .obj locally but not when I put it in Azure!can anyone helps me? Thanks!
推荐答案
[SOLVED] LOADING .OBJ (Wavefront) FILE IN WINDOWS HOSTING RETURN 404 ERROR [SOLVED]
[SOLVED] LOADING .OBJ (Wavefront) FILE IN WINDOWS HOSTING RETURN 404 ERROR [SOLVED]
当我使用 Three.js 并加载 .obj 文件时,在 localhost 中对我来说非常有用,但是当从 Windows 主机运行文件时,它为 .obj 文件返回 404.
As I was Working with Three.js and loading a .obj file works great for me in localhost but when running the files from the Windows Hosting it return 404 for the .obj file.
因此,我们需要将此行添加到项目根文件夹的 web.config 文件中(如果您的项目根文件夹中没有该文件,请继续创建一个.)
So, we need to add this lines to the web.config file of the project root folder (if you don't have the file in your project root folder then go ahead and create one. )
web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".obj" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>
将 web.config 放置到正确的位置并享受 :)
Place the web.config to correct location and Enjoy :)
这篇关于Three.js 在 Azure 中加载 .OBJ 错误但不在本地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!