无法在 Azure 网站上托管 MP4 文件 [英] Unable to host MP4 files on Azure web site

查看:41
本文介绍了无法在 Azure 网站上托管 MP4 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Azure 中的一个保留网站上托管一个静态网站(它是 PaaS,无法访问 OS/IIS).我正在尝试添加一些 .mp4 视频,但是当我点击链接时,我得到了

I am hosting a static website on a reserved web site in Azure (It is PaaS, no access to OS/IIS). I am trying to add some .mp4 videos but when I click on the links I get

The resource you are looking for has been removed, had its name changed, 
or is temporarily unavailable.

请在此处查看示例.如果我右键单击链接并尝试保存文件,我会得到 - 失败 - 没有文件.

Please see example here. If I right click on the link and try to save file I get - Failed - No file.

我使用的是付费实例,所以不要认为这是资源问题.视频文件小于 2MB.他们从来没有工作过.该网站非常静态.

I am using a paid instance so don't think it is resource issue. The video files are less than 2MB. They have never worked. The site is very static.

有谁知道我该如何解决这个问题?我应该以其他方式托管 MP4 文件吗?

Does anyone know how I can resolve this? Should I be hosting MP4 files in some other way?

谢谢,

推荐答案

链接的 SO 答案在概念上对我有用,但它没有指明适当的文件扩展名.我的配置必须改为指示以下内容.(请注意,对于任何有此问题的人,默认情况下,我的 azure 网站最初没有 web.config,因此我必须将以下内容添加到文本文件中,另存为 web.config,然后通过 FTP 传输到我的 webroot.

The linked SO answer worked for me conceptually, but it didn't indicate the appropriate fileExtension. My config had to instead indicate the following. (Note, for any who have this question, by default my azure website didn't have a web.config initially, so I had to add the following to a text file, save as web.config, and FTP to my webroot.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
               <remove fileExtension=".mp4" />
               <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
               <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
     </staticContent>
    </system.webServer>
</configuration>

这篇关于无法在 Azure 网站上托管 MP4 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆