Sitecore Cleanup Agentのエラー


解説

Sitecore Cleanup Agentは、デフォルトで6時間ごとに自動的に実行され、古いメディア キャッシュやログ ファイルなどの古いSitecore ファイルを削除してファイル システムを維持します。必要なファイルを削除するための十分な権限がない場合、Sitecore Cleanup Agentはエラーで失敗します。この記事では、関連するさまざまなエラー、考えられる原因、およびエラーの解決策について説明します。

エラーその1

メッセージ:

ERROR Exception in Scheduling.CleanupAgent. Folder: <フォルダ パス>
Exception: System.UnauthorizedAccessException
Message: Access to the path '<フォルダ パス>' is denied.
Source: mscorlib
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption searchOption)
   at Sitecore.Tasks.FileCleaner.GetCandidateFiles(DirectoryInfo folder)    at Sitecore.Tasks.FileCleaner.SimpleCleanup(DirectoryInfo folder)    at Sitecore.Tasks.FileCleaner.SimpleCleanup(DirectoryInfo folder, Boolean recursive)    at Sitecore.Tasks.CleanupAgent.Run()

解決策:

Webサイトで使用されるアプリケーション プール IDのエラー メッセージに記載されている、フォルダーの読み取り・書き込み・削除のセキュリティ権限を許可してください。

エラーその2

メッセージ:

INFO  File is being deleted by cleanup task: Filename: <親フォルダー>/<ファイル名>, file date: 12/12/2014 3:15:13 PM, age: 00:00:17.9730000 (min age: 00:30:00, max age: 00:00:10). Reason: File is older than max age 00:00:10
ERROR Could not delete candidate file.
Exception: System.UnauthorizedAccessException
Message: Access to the path '<ファイル名>' is denied.
Source: mscorlib
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileInfo.Delete()
   at Sitecore.Tasks.FileCleaner.GetCandidateFiles(DirectoryInfo folder)

解決策:

<親フォルダー>に対する「サブフォルダーとファイルの削除」アクセス許可が、Webサイトで使用されるアプリケーション プール IDに付与されていることを確認してください。

エラーその3

メッセージ:

INFO  File is being deleted by cleanup task: Filename: <ファイル名>, file date: 12/11/2014 3:41:44 PM, age: 00:00:22.2540000 (min age: 00:30:00, max age: 00:00:10). Reason: File is older than max age 00:00:10
INFO  File was skipped as it appears to be locked by another process.

解決策:

  1. 指定されたファイルの読み取り専用属性がfalseであるかどうかを確認します。
  2. Webサイトで使用されているアプリケーション プール IDに、指定したファイルに対する読み取り・書き込み・削除アクセス権があることを確認します。
  3. この時点でファイルが別のプロセスによってロックされている可能性があるため、Cleanup Agentが次に実行されるまで待ちます。