ASP经典无法使用IIS 7上的FileSystemObject访问虚拟目录 [英] ASP Classic can not access Virtual Directory using FileSystemObject on IIS 7

查看:139
本文介绍了ASP经典无法使用IIS 7上的FileSystemObject访问虚拟目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个经典的ASP网站,我们已经从IIS 6迁移到Win2k8和IIS7.在网站文件夹结构中,是一个名为Products的虚拟目录,其中包含JPG,这些物理存储在同一服务器上的其他位置.

I have a Classic ASP website which we have moved from IIS 6 to Win2k8 and IIS 7. Within the website folder structure, is a Virtual Directory called Products containing JPGs that are physically stored elsewhere on the same server.

在网络浏览器中,任何产品JPG均可正确显示在页面上.例如. http://www.MySite.com/images/poducts/widget.jpg 可以请客.

Within a web browser, any of the Product JPGs display correctly on the page. E.g. http://www.MySite.com/images/poducts/widget.jpg works a treat.

但是,当尝试使用FileSystemObject以ASP代码访问该文件夹时,该文件夹不可用-除虚拟目录外,所有其他文件/文件夹都在那里.这是一个示例ASP代码段:

However, this folder is unavailable when trying to access it in ASP code, using the FileSystemObject - all other files/folders are there except the Virtual Directory. Here is an example ASP code snippet:

Set objFSO = Server.CreateObject( "Scripting.FileSystemObject" )
Set objBaseFolder = objFSO.GetFolder( Server.Mappath( "../../Images" ) )
For Each objFolder In objBaseFolder.SubFolders  
    Response.Write( objFolder.Name & "<br>" )
Next
Set objFolder = Nothing
Set objBaseFolder = Nothing
Set objFSO = Nothing

此外,Persit的ASPJpeg Com Object可以从ASP代码打开JPG文件并从该虚拟目录保存JPG文件.

Additionally, Persit's ASPJpeg Com Object has no problem opening and saving JPG files to/from this Virtual Directory from ASP code.

在IIS7中,该网站有一个应用程序池",我尝试了所有方式对其身份进行的设置都无济于事.我还尝试过将各种安全设置(IUSR_,网络服务等)应用于虚拟目录指向的物理文件夹,甚至可以一次将完全控制权授予所有人".

In IIS7, the website has an Application Pool, and I've tried all manner settings for its identity to no avail. I have also tried applying various security settings (IUSR_, Network Service, et al) to the physical folder that the Virtual Directory points to - even granting full control to "Everyone" at one point.

似乎ASP过程没有对虚拟目录的许可.如果有人对如何解决这个问题有想法,那么我将非常感激.

It really seems like the ASP process does not have permission to Virtual Directories. If anyone has and idea on how to solve this problem then I'd be most greatful.

推荐答案

使用 FileSystemObject 进行此操作永远不会起作用,因为它仅适用于物理文件系统.它不了解或不了解虚拟目录-您站点的这一方面完全由IIS管理.

Using FileSystemObject to do this is never going to work because it only works on the physical file system. It does not know about or understand virtual directories - this aspect of your site is managed entirely by IIS.

这不是权限问题,而是目录实际不在目录中的问题,因此浏览物理文件系统将永远不会看到它

It is not a question of permissions it is a question of the directory not physically being there so browsing the physical file system will never see it

IIS管理虚拟目录:

IIS manages virtual directories:

  • 在浏览器中导航到图像是可行的,因为IIS会自动将虚拟路径映射到适当的物理路径.
  • 最有可能使用AspJpeg,因为它使用对 Server.MapPath 的调用来将给定路径解析为物理路径
  • Navigating to an image in your browser works because IIS automatically maps the virtual path to the appropriate physical path.
  • Using AspJpeg works most likely because it uses calls to Server.MapPath to resolve the given path into a physical path

这不是权限问题,因为您自己说过AspJpeg可以读写虚拟目录,也可以通过浏览器访问它.

This cannot be an issue of permissions since you stated yourself that AspJpeg can read and write to the virtual directory fine plus you can access it through your browser fine.

这篇关于ASP经典无法使用IIS 7上的FileSystemObject访问虚拟目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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