简体   繁体   中英

System.UnauthorizedAccessException: Access to the path 'C:\inetpub\wwwroot\website\imagecache\0f\ae1ea.jpg.tmp_4a1f20d7.tmp' is denied

Using imageresizer diskcache 4.2.5 and just recently started having a high frequency of this error. This is after doing a recent publish of new code to our site. We did not explicitly change anything to our knowledge related to imageresizer, so not sure if it is related to a new version, a web.config issue, etc.

We are using precompiled views in this MVC 5 web app.

Gist debug file

This has been working for years. It looks like we updgraded the nuget package of this from 3.4.3 to 4.2.5 a couple of months ago.

When navigating to the image directly, no error is thrown. The funny thing to me is this .tmp naming convention of the file trying to be accessed.

The path of the image is is trying to retrieve from the Elmah error log is: C:\\inetpub\\wwwroot\\website\\Images\\no_image.jpg?maxwidth=420&maxheight=420

Stacktrace:

System.UnauthorizedAccessException: Access to the path 'C:\inetpub\wwwroot\website\imagecache\0f\ae1ea13d9acc62f74c3da0f38e1b85328c07effdd1afce83d91b44f244a602f3.jpg.tmp_4a1f20d7.tmp' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at ImageResizer.Plugins.DiskCache.CustomDiskCache.<>c__DisplayClass29_0.<TryWriteFile>b__0()
   at ImageResizer.Plugins.DiskCache.LockProvider.TryExecute(String key, Int32 timeoutMs, LockCallback success)
   at ImageResizer.Plugins.DiskCache.CustomDiskCache.GetCachedFile(String keyBasis, String extension, ResizeImageDelegate writeCallback, Int32 timeoutMs, Boolean asynchronous)
   at ImageResizer.Plugins.DiskCache.DiskCache.Process(IResponseArgs e)
   at ImageResizer.Plugins.DiskCache.DiskCache.Process(HttpContext context, IResponseArgs e)
   at ImageResizer.InterceptModule.HandleRequest(HttpContext context, HttpModuleRequestAssistant ra, IVirtualFile vf)
   at ImageResizer.InterceptModule.CheckRequest_PostAuthorizeRequest(Object sender, EventArgs e)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.<>c__DisplayClass285_0.<ExecuteStepImpl>b__0()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

This means that the app does not have write permission to the folder. A temp name is used to prevent it from being served while writing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM