在 IIS 7.5 中部署时,MVC3 应用程序中的 JWPlayer 无法工作
我正在使用 C# 和 Razor 开发 ASP.NET MVC3 应用程序。我创建了一个页面,用户可以在其中播放位于应用程序目录树中的视频文件。
当我在本地测试该应用程序时,它工作正常,当我将其部署在带有 IIS 7.5 的 MS Server 2008 中时,除了视频流之外,一切都工作正常。
该页面甚至不显示播放器,这让我认为应用程序找不到加载播放器所需的 Javascript 文件。我尝试了所有类型的 URL 编码,设置了不同类型的权限,但这并没有解决问题。在此我发布View的代码:
@model System.String
@{
ViewBag.Title = "Play";
}
<h2>Playing Topic Video</h2>
<div id='player'>This div will be replaced by the JW Player.</div>
<script type='text/javascript' src='@Url.Content("/FLV Player/jwplayer.js")'></script>
<script type='text/javascript'>
var filepath = @Html.Raw(Json.Encode(Model));
jwplayer('player').setup({
'flashplayer':'@Url.Content("/FLV Player/player.swf")',
'width': '400',
'height': '300',
'file': filepath
});
</script>
其中Model是代表视频文件path的字符串。有人可以帮我解决这个问题吗?
谢谢
弗朗西斯科
I am developing an ASP.NET MVC3 application with c# and Razor. I created a page where the user can play video files which are located in the application directory tree.
When I tested the application locally it was working correctly, when I deployed it in MS Server 2008 with IIS 7.5 everything worked fine except the video streaming.
The page does not even display the player and this let me think that the application cannot find the Javascript file needed to load the player. I tried all the types of URL encoding, I set different types of permission but that did not solve the problem. Hereby I post the code of the View:
@model System.String
@{
ViewBag.Title = "Play";
}
<h2>Playing Topic Video</h2>
<div id='player'>This div will be replaced by the JW Player.</div>
<script type='text/javascript' src='@Url.Content("/FLV Player/jwplayer.js")'></script>
<script type='text/javascript'>
var filepath = @Html.Raw(Json.Encode(Model));
jwplayer('player').setup({
'flashplayer':'@Url.Content("/FLV Player/player.swf")',
'width': '400',
'height': '300',
'file': filepath
});
</script>
Where Model is a string representing the path of the video file. May anybody help me with this issue?
Thanks
Francesco
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
而不是:
您应该:
注意
~
。这就是您在两个网址中都缺少的内容。使用Url.Content
帮助器时,始终在开头放置~
。它将代表虚拟目录名称。Instead of:
You should:
Notice the
~
. This is what you are missing in both your urls. Always put a~
in the beginning when you are using theUrl.Content
helper. It will represent the virtual directory name.