将OutputCache添加到ASP.NET WebForm会导致我的网站崩溃:(

时间:2010-03-29 07:37:03

标签: asp.net webforms crash outputcache

当我添加其中一个......

<%@ 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。在我的localhost上,它肯定会..并包含一个很大的ascx控件列表。

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

那么......这里发生了什么?

有人可以帮忙吗?

哦:)在有人建议我创建这两个文件夹,甚至在这些文件夹中粘贴一个随机文件..并在这些随机文件中有一些随机文本..我已经完成了它似乎不起作用,仍然:(

请帮助!

更新

当我尝试使用IIS进行失败的请求跟踪时,我注意到了这一点......

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

1 个答案:

答案 0 :(得分:0)

嗯。我不确定这是否是一个可以接受的答案,但我有点想出来。

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

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

    现在可行。

    所以问题是缓存需要检查文件夹。我猜测帐户(NetworkSystem)只是不允许它创建文件夹,如果它不存在..即使我手动授予根文件夹的权限(我假设,儿童)。

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