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

<%@ 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 进行失败的请求跟踪时,我注意到了这一点......

替代文本http://img136.imageshack.us/img136/1351/notsure.png

有帮助吗?

解决方案

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

  1. 该项目是一个ASP.NET 网站 (相对于 网络应用 或一个 MVC1/2 类型)。
  2. 我必须为该控件创建一个文件夹,该文件夹位于 aspx 页面上。(例如。\控制\信息建议
  3. 我必须为母版页创建一个文件夹,该文件夹由页面 \masterpages 使用

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

现在可以了。

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

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top