果园CMS主题图像没有出现

时间:2013-01-31 21:57:55

标签: orchardcms

我正在使用正确的帮助程序调用来获取主题中图像的URL:

@Url.Content(Html.ThemePath(WorkContext.CurrentTheme, "/Content/Images/my-image.png")

...我知道图像在那里并且可读。然而,当我尝试浏览它时,它并没有出现!为什么会这样?

1 个答案:

答案 0 :(得分:6)

来自文档(http://docs.orchardproject.net/Documentation/Anatomy-of-a-theme):

  

要启用文件,每个包含样式表,图像或JavaScript代码等静态文件的文件夹都应包含一个包含以下内容的web.config文件

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <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>
    <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>