【问题标题】:HTTP 404: The /Media directory is not serving imagesHTTP 404:/Media 目录不提供图像
【发布时间】:2014-11-27 02:32:37
【问题描述】:

我克隆了客户的 Orchard CMS。我克隆的存储库不包含Media 文件夹(这很好)。因此,下一步是从.zip 备份恢复Media/Default 目录。现在我已经恢复了,浏览到站点会为 Media 文件夹中的所有资源提供 404 错误。为什么?

【问题讨论】:

    标签: http-status-code-404 orchardcms orchardcms-1.8 static-content iis-handlers


    【解决方案1】:

    快速修复

    /Media 文件夹缺少所需的 Web.config 文件。添加它。

    媒体/Web.config

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <appSettings>
        <add key="webpages:Enabled" value="false" />
      </appSettings>
      <system.web>
        <httpHandlers>
          <!-- iis6 - for any request in this location, return via managed static file handler -->
          <add path="*" verb="*" type="System.Web.StaticFileHandler" />
        </httpHandlers>
      </system.web>
      <system.webServer>
        <staticContent>
          <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
        </staticContent>
    
        <handlers accessPolicy="Script,Read">
          <!--
          iis7 - for any request to a file exists on disk, return it via native http module.
          accessPolicy 'Script' is to allow for a managed 404 page.
          -->
          <add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
        </handlers>
      </system.webServer>
    </configuration>
    

    详情

    开箱即用,Orchard 的 Media 文件夹包含一个 Web.config 文件。由于源代码控制排除了Media 文件夹,因此它也没有Web.config。在 IIS 7+ 集成模式下,提供静态文件需要以下配置,因为根 Orchard.Web/Web.config 文件 &lt;clear/&gt;s 所有处理程序。

    <add name="StaticFile" 
         path="*" 
         verb="*" 
         modules="StaticFileModule" 
         preCondition="integratedMode" 
         resourceType="File" 
         requireAccess="Read" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-17
      • 2019-07-04
      • 2011-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多