We have configured a custom storage module according to the follwoing documentation:
https://docs.kentico.com/13/custom-development/working-with-physical-files-using-the-api/configuring-file-system-providers/configuring-amazon-s3
Occasionally, we have an issue that results in broken images. It appears that the .meta files are being both read and written to. For example:
An unhandled exception has occurred while executing the request.
Message: The process cannot access the file '[Redacted]\App_Data\AmazonTemp__metadata[Redacted]\files\8c\8c410fdc-fe3e-40a1-b351-343fdcb44a07.jpg.meta' because it is being used by another process.
Exception type: System.IO.IOException
Stack trace:
at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable
1 unixCreateMode)
at Amazon.S3.Model.GetObjectResponse.WriteResponseStreamToFileAsync(String filePath, Boolean append, CancellationToken cancellationToken)
at CMS.AmazonStorage.S3ObjectInfo.LoadMetadata(String path)
at CMS.AmazonStorage.S3ObjectInfo.FetchMetadata()
at CMS.AmazonStorage.GetAmazonFileService.GetExternalFile(String filePath)
at CMS.Routing.Web.GetExternalFileService.GetFileServiceResult()
at CMS.Routing.Web.AdvancedGetFileService.GetActionResultInternal()
at CMS.Routing.Web.ActionResultServiceBase.GetActionResult()
at CMS.AspNetCore.Platform.Routing.Internal.ActionResultMiddleware.InvokeAsync(HttpContext context)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Rewrite.RewriteMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Kentico.Content.Web.Mvc.ContentOutputMiddleware.InvokeAsync(HttpContext context)
at Kentico.Web.Mvc.KenticoRequestLocalizationMiddleware.InvokeAsync(HttpContext context)
at Kentico.Content.Web.Mvc.PageRedirectionContextMiddleware.InvokeAsync(HttpContext context)
at Kentico.Web.Mvc.KenticoRequestEventsMiddleware.InvokeAsync(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
We have verified that the Temp files have read/write privileges. We are mapping the following for each site:
StorageHelper.MapStoragePath("[SiteFolder]/media/", mediaProvider);
StorageHelper.MapStoragePath("[SiteFolder]/files/", filesProvider);
StorageHelper.MapStoragePath("[SiteFolder]/metafiles/", metafilesProvider);
Any suggestions on how to resolve this error are appreciated.