System.UnauthorizedAccessException:拒绝访问路径'C:\ inetpub \ wwwroot \ website \ imagecache \ 0f \ ae1ea.jpg.tmp_4a1f20d7.tmp'

时间:2019-04-30 17:36:29

标签: imageresizer imageresizer-diskcache

使用imageresizer diskcache 4.2.5,并且刚开始出现此错误的可能性很高。这是在最近将新代码发布到我们的网站之后。我们并未明确更改与imageresizer相关的任何知识,因此不确定是否与新版本,web.config问题等有关。

我们正在此MVC 5 Web应用程序中使用预编译的视图。

Gist debug file

这已经工作了多年了。看来我们几个月前已将其nuget软件包从3.4.3升级到4.2.5。

直接导航到图像时,不会引发任何错误。对我来说有趣的是,尝试访问该文件的.tmp命名约定。

尝试从Elmah错误日志中检索的图像路径为: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)

1 个答案:

答案 0 :(得分:0)

这意味着该应用没有对该文件夹的写入权限。临时名称用于防止在写入时被提供。