0

I have a couple virtual directories in IIS 7.5 that point to network resources. Specifically, these folders hold PDF files. I've granted a user permission to these folders, and their contents are accessible via web requests as I would expect. For example, http://mysite/dir1/test.pdf works perfectly for both virtual directories. However, when I try to expand one of the virtual directories (the other works fine) to see sub folders, IIS Manager becomes unresponsive almost immediately.

I'm attempting to list the file names of all PDFs in virtual directory on a classic ASP page.

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
filepath = Server.MapPath("/resources/myfolder")
Set folder = objFSO.GetFolder(filepath)
For Each file in folder.Files
    If file.Type = "PDF File" Then
        Response.Write("<p>" & file.Name & "</p>")
    End If
End If

Set folder = Nothing
Set objFSO = Nothing

On a separate page, I using identical code to list the contents of another virtual directory. However, this other directory (as with IIS Manager) causes problems by not responding. It causes the entire site to become unresponsive and I have to recycle to app pool to get it to come back.

The effective permissions for the user account used to access these resources are identical. All files are accessible, and I've confirmed they exist via hardcoding fso.FileExists(filepath & filename). I've also confirmed that the folder object exists and it's properties are being set. Even the folder.Files.Count is set properly in both cases. The issue is that the call to iterate through folder.Files causes the unresponsive behavior. Are there file size and/or folder size limitations? The only difference I see between the two directories is the number of files and consequently the size of the folder. The one that doesn't work is just over 1GB.

4

1 回答 1

0

我不知道存在大小限制。我会假设限制是我的机器存储的大小。至于显示文件夹内所有文件的列表,当列表变长时,您可能会遇到一些速度问题。获取文件路径等会导致文件 I/O 操作占用更多资源。我会设计我的应用程序,每次用户发布新的 PDF 时,我都会将文件详细信息(名称、位置)存储在数据库中,然后将图像放入文件夹中。这样,当用户想要检索文件时,我会进行文件抓取(这是文件 I/O 并占用更多资源),如果我只想显示文件列表,我会从数据库表中读取它超过 4 列宽,数据库可以轻松处理数百万行读取。

于 2012-07-17T20:46:24.493 回答