【发布时间】:2017-11-09 00:51:41
【问题描述】:
我正在尝试使用 VR View for the web 显示 360 度图像。我在本地创建了一个基本示例,它可以正常工作,但是一旦我将代码放入我的项目中,我就会收到一个 404 错误,提示找不到资源。
vrview.min.js 文件正在将我的图像路径(如 image: 'images/myImage.jpg' 输入)转换为:
http://localhost:80/Project/index.html?image=http://localhost/Project/images/myImage.jpg&is_stereo=false&
IIS 没有找到图像,整个过程抛出了一个巨大的 404 服务器错误。
这是我的代码:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>View 360 Image</title>
<script type="text/javascript">
window.addEventListener('load', onVrViewLoad);
function onVrViewLoad() {
var vrView = new VRView.Player('#vrview', {
image: 'images/myImage.jpg',
width: 800,
height: 700,
is_stereo: false
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="vrview"></div> <!-- Placeholder where the VR player will display -->
</form>
<script src="includes/vrview.min.js"></script>
</body>
</html>
任何帮助都会很棒。谢谢!
【问题讨论】:
-
这是一个路径问题。您需要确保图像中的路径正确:属性。您还应该确保在项目的该路径中有该图像文件。请记住“images/”与“/images/”指向不同的位置。 / 将带您从根目录开始,没有它,您将从当前所在的 url 开始。
-
@Liquidchrome - 如果我去掉
http://localhost:80/Project/index.html?image=和变量并将http://localhost/Project/images/myImage.jpg粘贴到浏览器中,它会完美地显示图像。 -
所以在您的代码中, image: 'images/mem_off_tab.jpg' 是否以localhost/Project/images/mem_off_tab.jpg 的形式存在?还可以尝试将其传递给创建的 url...localhost:80/Project/index.html?image=http://localhost/Project/…
-
woops... 旨在为该问题通用该文件名。但是,是的,这是存在的。
-
@Liquidchrome - 但是,第二个链接不起作用。我无法将图像的 URL 作为参数传递给索引页。
标签: javascript asp.net iis http-status-code-404 virtual-reality