構造内に 4000000 を超える jpeg ファイルを取得した後、新しいファイルを追加する際に問題が発生しました。File.Copy は例外をスローします: ファイル システムの制限により、要求された操作を完了できませんでした。
解決策はありますか?
情報
- システム: Windows Server 2008 SP1 x64
- インストール パス: http://support.microsoft.com/kb/967351/en-us?fr=1
- 最適化:完了
コード
public bool AddFile(Uri uri, string path, bool withDelete = false)
{
var sourceFilePath = path;
var destinationFilePath = Path.GetFullPath(uri.LocalPath);
try
{
if (!File.Exists(sourceFilePath))
{
sourceFilePath = Directory.EnumerateFiles(sourceFilePath).FirstOrDefault();
destinationFilePath = Path.Combine(destinationFilePath, Path.GetFileName(sourceFilePath));
}
if (!Directory.Exists(Path.GetDirectoryName(destinationFilePath)))
Directory.CreateDirectory(Path.GetDirectoryName(destinationFilePath));
if (withDelete && File.Exists(destinationFilePath))
File.Delete(destinationFilePath);
File.Copy(sourceFilePath, destinationFilePath);
return true;
}
catch (Exception exc)
{
ServiceCore.GetLogger().Error(exc);
throw exc;
}
}
スタックトレース
2013-03-28 14:10:48.3784[Info]: 47356388:Unive.NetService.SimpleServices.DocumentManagementSerivce..ctor: Entry
2013-03-28 14:10:48.4740[Info]: Static:Unive.NetService.SimpleServices.DocumentManagementSerivce..ctor: Success
2013-03-28 14:10:48.4899[Info]: 47356388:Unive.NetService.SimpleServices.DocumentManagementSerivce.UploadFile: Entry
2013-03-28 14:11:26.3277[Error]: Exception
Message:The requested operation could not be completed due to a file system limitation
Source:mscorlib
Stack Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at Unive.NetService.Business.SimpleFileClient.AddFile(Uri uri, String path, Boolean withDelete) in D:\Tag Prografix\Unive.NetService\Business\SimpleFileClient.cs:line 33
TargetSite:Void WinIOError(Int32, System.String)
2013-03-28 14:11:26.5029[Error]: 47356388:Unive.NetService.SimpleServices.DocumentManagementSerivce.UploadFileException
Message:The requested operation could not be completed due to a file system limitation
Source:mscorlib
Stack Trace: at Unive.NetService.Business.SimpleFileClient.AddFile(Uri uri, String path, Boolean withDelete) in D:\Tag Prografix\Unive.NetService\Business\SimpleFileClient.cs:line 42
at Unive.NetService.Business.FileService.UploadFile(Int64 fileId, String fileName, String path, Boolean isDiagram) in D:\Tag Prografix\Unive.NetService\Business\FileService.cs:line 80
at Unive.NetService.SimpleServices.DocumentManagementSerivce.UploadFile(Int64 fileId, String fileName, String path) in D:\Tag Prografix\Unive.NetService\SimpleServices\DocumentManagementSerivce.asmx.cs:line 100
TargetSite:Void WinIOError(Int32, System.String)