无法从Orchard模块中的项目文件夹加载图像

Ste*_*tic 5 orchardcms razor asp.net-mvc-3

我正在尝试在我的Orchard模块中插入图像,但我遇到了一些问题.

<img  src="@Href("~/Modules/Orchard.Slider/Content/img/other.jpg")"/>
Run Code Online (Sandbox Code Playgroud)

在我看来,我写了thibut图像没有加载,它说没有找到资源.但是,如果我将我的图片放在Orchard.Users模块文件夹中,它正在工作:

<img  src="@Href("~/Modules/Orchard.Users/Content/img/other.jpg")"/>
Run Code Online (Sandbox Code Playgroud)

有谁知道为什么会这样?这是一个错误,还是我错过了什么?

只是添加,当我第一次尝试构建相同的模块时,我正常从我的文件夹中加载图像(使用第一行代码),但我无法包含css文件,因为

@{Style.Include("slider_style.css");}
Run Code Online (Sandbox Code Playgroud)

没有生产任何东西.事实并非如此,我的html源码中有'资源未找到的东西' - 考虑到包含slider_style.css,没有任何一行

然后我再次创建了相同的项目,现在我可以包含css,但无法加载图像.问题是我只是复制/粘贴代码,只是改变了我实际上创建了一个新的Orchard模块项目和新的.cs和cshtml.文件.

在此先感谢,Stefan

rfc*_*ong 8

尝试将以下web.config文件放在img文件夹中.

<?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>
    <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>
Run Code Online (Sandbox Code Playgroud)