我有一个托管 wcf 服务以允许远程文件和文件夹浏览的 Windows 服务。Windows 服务在本地系统帐户下运行。
浏览c:\
驱动器时,该服务会报告该文件夹中的 2800 多个文件。我已经单步执行了代码,它确实报告了 >2800 个文件。
这怎么可能是正确的?
C# 代码
//Files Manager
public ReturnClass FindSubFiles(String Folder_To_Search, String User, String SessionId)
{
ReturnClass myReturnClass = new ReturnClass(-1, String.Empty, String.Empty, null, null, null, null);
try
{
Logging.Write_To_Log_File("Entry", MethodBase.GetCurrentMethod().Name, "", "", "", "", User, SessionId, 1);
string[] filePaths = Directory.GetFiles(Folder_To_Search);
int count = 0;
foreach (string Folder in filePaths)
{
filePaths[count] = Path.GetFileName(filePaths[count]);
count++;
}
myReturnClass.ErrorCode = 1;
myReturnClass.FilePaths = filePaths;
Logging.Write_To_Log_File("Exit", MethodBase.GetCurrentMethod().Name, "", "", "", "", User, SessionId, 1);
return myReturnClass;
}
catch (Exception ex)
{
Logging.Write_To_Log_File("Error", MethodBase.GetCurrentMethod().Name, "", "", ex.ToString(), "", User, SessionId, 2);
myReturnClass.ErrorCode = -1;
myReturnClass.ErrorMessage = ex.ToString();
return myReturnClass;
}
}