外部wwwroot图像无法显示(尽管映射) [英] Images from outside wwwroot not displaying (despite mapping)

查看:124
本文介绍了外部wwwroot图像无法显示(尽管映射)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的ColdFusion应用程序中,我想将图像保存在wwwroot之外的这个文件夹中:C:\\\ xxtSite \ stdImages

In my ColdFusion application, I want to keep the images outside of wwwroot in this folder: C:\extSite\stdImages

我在wwwroot中创建了一个映射\ WEB-INF \ _jrun-web.xml是这样的:

I created a mapping in wwwroot\WEB-INF\jrun-web.xml like this:

<virtual-mapping>
    <resource-path>/extStdImages</resource-path>
    <system-path>C:\extSite\stdImages\</system-path>
</virtual-mapping>

要显示图像,我这样做:

To display an image, I do this:

<img src="/extStdImages/abc.jpg">

这在我的开发网站(使用ColdFusion的内置网络服务器)上运行正常,但是生产中没有显示图像(我使用的是IIS)。我想知道是否必须在IIS或生产服务器上的其他地方调整某些内容以允许访问这些文件。

This works fine on my dev site (which is using ColdFusion's built-in web server), but the image does not display in production (where I am using IIS). I am wondering if I have to tweak something in IIS or elsewhere on the production server to allow access to these files.

任何人都可以帮忙吗?提前致谢!

Can anyone help? Thanks in advance!

彼得

推荐答案

在iis中你需要创建指向images文件夹的虚拟目录。虽然将图像放在wwwroot之外是没有意义的,因为它们必须是Web可访问的,以便它们显示在网页上。这样做的唯一原因是。如果您使用密码保护版权图像而不是直接链接到它们。

In iis you would need to create a virtual dir that points to the images folder. Although putting images outside the wwwroot is pointless as they must be web accessible in order for them to display on a web page. The only reason to do this would be.if you were protecting copyright images with passwords and not linking to them directly.

这篇关于外部wwwroot图像无法显示(尽管映射)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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