Azure .mp4 上传失败

Azure .mp4 upload fails

早上好,

我们已经在 Azure 应用服务上设置了一个 Laravel 项目。我们致力于上传 .mp4 文件的能力。如果我们尝试上传 .zip、.jpg、.doc 等,它们都可以正常工作。 .mp4 文件虽然总是给出错误。我们找到的大多数答案都说它是 web.config,但我们认为它是正确的。这是一些信息:

我们得到的错误:404 未找到:您要查找的资源已被删除、已更改名称或暂时不可用。

我的web.config文件位置是: D:\home\site\wwwroot\public\web.config

我的上传目录是: D:\home\site\wwwroot\public\test

我的 web.config 看起来像:

<configuration>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".mp4" mimeType="application/octet-stream" />
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
    </staticContent>
    <handlers accessPolicy="Read, Script">
      <add name="PHP71_via_FastCGI" path="*.php" verb="GET, HEAD, POST, PUT, DELETE, PATCH, OPTIONS" modules="FastCgiModule" scriptProcessor="D:\Program Files (x86)\PHP\v7.1\php-cgi.exe"
        resourceType="Either" requireAccess="Script" />
      <remove name="ExtensionlessUrl-Integrated-4.0" />
      <add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,DELETE,PUT,PATCH,OPTION" type="System.Web.Handlers.TransferRequestHandler"
        preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
    <rewrite>
      <rules>
        <rule name="Imported Rule 1" stopProcessing="true">
          <match url="^(.*)/$" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
        </rule>
        <rule name="Imported Rule 2" stopProcessing="true">
          <match url="^" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.php" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

如您所见,我们在那里有 mimeMap。 application/octet-stream 和 video/mp4 我们都试过了。有人有 thoughts/ideas 吗?我们尝试将 web.config 放在其他文件夹中,也有同样的问题。

我尝试的另一件事是进入 Kodu 并通过那里手动上传文件。它有效,但如果您尝试访问 .mp4,它会显示与我尝试通过网站上传时相同的错误。

.mp4 文件大小是否大于 8MB?如果是这样,您需要增加文件上传大小限制。

使用以下内容创建一个名为 .user.ini 的文件并将其放入您的根目录。

; Maximum allowed size for uploaded files.
upload_max_filesize = 2048M

; Must be greater than or equal to upload_max_filesize
post_max_size = 2048M

如果文件大小大于 30MB,您还需要将其添加到 web.config 文件中。

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="2147483648" />
      <!--Byte in size, increase it to 2GB-->
    </requestFiltering>
  </security>
</system.webServer>