这是我自己的问题的答案。解决的办法是修改Lucene.Net.Store.FSDirectory,注释掉这个空着的线路:
// Comments out by Corey Trager, Oct 2008 to workaround permission restrictions at shared host. This is not used.
// public static readonly System.String LOCK_DIR = SupportClass.AppSettings.Get("Lucene.Net.lockDir", System.IO.Path.GetTempPath());
有后一个更安全权限的障碍,而这里的是解决办法了。我不明白为什么一种获取目录中文件名称的方法会被阻止,另一种方式不会被阻止。
public override System.String[] List()
{
/* Changes by Corey Trager, Oct 2008, to workaround permission restrictions at shared host */
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(directory.FullName);
System.IO.FileInfo[] files = dir.GetFiles();
string[] list = new string[files.Length];
for (int i = 0; i < files.Length; i++)
{
list[i] = files[i].Name;
}
return list;
/* end of changes */
// System.String[] files = SupportClass.FileSupport.GetLuceneIndexFiles(directory.FullName, IndexFileNameFilter.GetFilter());
// for (int i = 0; i < files.Length; i++)
// {
// System.IO.FileInfo fi = new System.IO.FileInfo(files[i]);
// files[i] = fi.Name;
// }
// return files;
}