播放视频时出现服务器错误:HTTP错误404.3

Abh*_*pta 1 asp.net video iframe html5 visual-studio-2010

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

HTML

<iframe id="frame1" runat="server" visible="false"
       style="height: 222px; width: 482px;"></iframe>
Run Code Online (Sandbox Code Playgroud)

Finalpath = filepath + filename;
frame1.Visible = true;
frame1.Attributes.Add("src", Finalpath);
Run Code Online (Sandbox Code Playgroud)

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

HTTP Error 404.3 - Not Found
Run Code Online (Sandbox Code Playgroud)

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

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

Yog*_*pta 13

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

<system.webServer>
    <staticContent>
        <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
    </staticContent>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)

您可以使用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> 
Run Code Online (Sandbox Code Playgroud)

  • <Video>标签是HTML 5中的新功能,如果您使用的是VS 2010,它将不会显示任何智能.但您可以在aspx标记文件中使用它.但要运行浏览器必须支持html5. (2认同)