【问题标题】:Adding OutputCache to an ASP.NET WebForm crashes my site :(将 OutputCache 添加到 ASP.NET WebForm 会使我的网站崩溃:(
【发布时间】:2010-03-29 07:37:02
【问题描述】:

当我添加其中任何一个时...

<%@ OutputCache Duration="600" Location="Any" VaryByParam="*" %>

<%@ OutputCache CacheProfile="CmsArticlesListOrItem" %>

(.. and this into the web.config file...)
<caching>
    <outputCacheSettings>
        <outputCacheProfiles>
            <add name="CmsArticlesListOrItem" duration="600" varyByParam="*" />
         </outputCacheProfiles>
    </outputCacheSettings>

    <sqlCacheDependency ........ ></sqlCacheDependency
</caching>

我的页面/网站崩溃并出现以下错误:-

Source: System.Web
----------------------------------------------------------------------------
TargetSite: System.Web.DirectoryMonitor FindDirectoryMonitor(System.String, Boolean, Boolean)
----------------------------------------------------------------------------
Message:System.Web.HttpException: Directory 'C:\Web Sites\My Site Foo - Main Site\Controls\InfoAdvice' does not exist. Failed to start monitoring file changes.
   at System.Web.FileChangesMonitor.FindDirectoryMonitor(String dir, Boolean addIfNotFound, Boolean throwOnError)
   at System.Web.FileChangesMonitor.StartMonitoringPath(String alias, FileChangeEventHandler callback, FileAttributesData& fad)
   at System.Web.Caching.CacheDependency.Init(Boolean isPublic, String[] filenamesArg, String[] cachekeysArg, CacheDependency dependency, DateTime utcStart)
   at System.Web.Caching.CacheDependency..ctor(Int32 dummy, String[] filenames, DateTime utcStart)
   at System.Web.Hosting.MapPathBasedVirtualPathProvider.GetCacheDependency(String virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
   at System.Web.ResponseDependencyList.CreateCacheDependency(CacheDependencyType dependencyType, CacheDependency dependency)
   at System.Web.HttpResponse.CreateCacheDependencyForResponse(CacheDependency dependencyVary)
   at System.Web.Caching.OutputCacheModule.InsertResponse(HttpResponse response, HttpContext context, String keyRawResponse, HttpCachePolicySettings settings, CachedVary cachedVary, CachedRawResponse memoryRawResponse)
   at System.Web.Caching.OutputCacheModule.OnLeave(Object source, EventArgs eventArgs)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

好的 .. 所以出于某种原因,OutputCache 想要一个文件夹/文件在那里? ? ? ?

嗯,我已经让这个网站运行了大约 3 年,我很确定文件夹 \Controls\Controls\InfoAdvice 在我的生产服务器上不存在。在我的本地主机上,它确实可以......并且包含大量 ascx 控件。

但它们在我的实时服务器上不存在。

那么……这是怎么回事?

有人可以帮忙吗?

哦 :) 在有人建议我创建这两个文件夹甚至在这些文件夹中粘贴一个随机文件之前.. 并在这些随机文件中添加一些随机文本.. 我已经这样做了,但它似乎不起作用,还是:(

请帮忙!

更新

当我尝试使用 IIS 执行 FAILED REQUEST TRACE 时,我注意到了这一点......

alt text http://img136.imageshack.us/img136/1351/notsure.png

【问题讨论】:

    标签: asp.net webforms crash outputcache


    【解决方案1】:

    嗯。我不确定这是否是一个可以接受的答案,但我已经弄清楚了。

    1. 该项目是一个 ASP.NET Web 站点(与 Web 应用程序MVC1/2 类型相对)。李>
    2. 我必须为控件创建一个文件夹,该文件夹存在于 aspx 页面上。 (例如。\controls\infoadvice
    3. 我必须为母版页创建一个文件夹,供页面 \masterpages 使用

    然后我在这两个新文件夹中添加了一个简单的 txt 文件......其中包含一些虚拟内容。这使得这些文件夹(和虚拟文件)能够在为部署“构建”项目时发布(我正在使用 Web 部署项目 + TFS 构建)。

    现在可以了。

    所以问题是缓存需要检查文件夹。我猜该帐户(NetworkSystem)只是不允许它在不存在的情况下创建文件夹..即使我手动授予了根文件夹的权限(我假设是孩子)。

    哦,好吧 - 问题解决了。我不喜欢它..但它已经解决了。

    【讨论】:

      猜你喜欢
      • 2015-04-06
      • 1970-01-01
      • 2021-07-08
      • 2011-11-03
      • 2018-12-11
      • 2015-03-30
      • 2018-07-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多