asp.net - 播放视频时服务器出错 : HTTP Error 404. 3

标签 asp.net visual-studio-2010 html video iframe

我有一个应用程序,我需要将视频上传为:

html

<iframe id="frame1" runat="server" visible="false"
       style="height: 222px; width: 482px;"></iframe>

代码

Finalpath = filepath + filename;
frame1.Visible = true;
frame1.Attributes.Add("src", Finalpath);

但是当我加载视频扩展 Mp4 时,它在 Iframe 中显示错误

HTTP Error 404.3 - Not Found

由于扩展程序配置,无法提供您请求的页面。如果页面是脚本,请添加处理程序。如果要下载文件,请添加 MIME 映射。

如何处理此服务器错误以及我可以上传什么类型(扩展名)的视频?感谢您的帮助..

最佳答案

您应该在 IIS 或 web.config 文件中为 .MP4 格式添加 MIME 类型 在 Web.Config For IIS 7 中,您可以在配置中添加此部分。

<system.webServer>
    <staticContent>
        <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
    </staticContent>
</system.webServer>

您可以使用 HTML 5 <video>标记以显示您的 .mp4 视频

<video width="320" height="240" controls="controls">
  <source src="movie.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video> 

关于asp.net - 播放视频时服务器出错 : HTTP Error 404. 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12634414/

相关文章:

c# - WinForm 应用程序无法运行,因为 ".exe is missing"

c# - 将 C# 项目从 VS2010 升级到 VS2012

php - 我的 ajax 上传带有 utf-8 字符集中西类牙字母的 csv 文件剪切了我的寄存器

c# - 使用C#生成正态分布图

c# - ASP.Net Web 服务中的 JQUery 自动完成

c# - 使用C#将文本框中的数据写入ASP.net中的文本文件

c# - 创建新实例或仅设置内部变量

c# - Visual Studio 单元测试 Assert.AreEqual 因预期值和实际值相同而失败

php - 购物车中不显示总金额

javascript - 使用 jquery 切换内容