views:

166

answers:

1

Hi folks,

When I add either one of these ...

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

or

<%@ OutputCache CacheProfile="CmsArticlesListOrItem" %>

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

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

my page/site crashes with the following error:-

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)

Ok .. so for some reason, the OutputCache wants a folder/file to be there? ? ? ?

Well, i've had this site live for around 3 years and i'm pretty sure that the folders \Controls and \Controls\InfoAdvice doesn't exist on my production server. On my localhost, it sure does .. and contains a large list of ascx controls.

But they don't exist on my live server.

So ... what is going on here?

Can anyone please help?

Oh :) Before someone suggests I create those two folders and even stick a random file in those folders .. and have some random text in those random files .. i've done that and it doesn't seem to work, still :(

Please Help !

Update

When i tried to do a FAILED REQUEST TRACE with IIS, I noticed this....

alt text

A: 

Hmm. I'm not sure if this is an acceptable answer or not, but I've sorta figure this out.

  1. The project is an ASP.NET Web Site (as opposed to a Web Aplication or an MVC1/2 type).
  2. I had to create a folder for the control, which exists on the aspx page. (eg. \controls\infoadvice
  3. I had to create a folder for the master page, which is used by the page \masterpages

I then added a simple txt file into both those new folders .. with some dummy content in them. This enabled those folders (and dummy files) to be published when the project is 'built' for deployment (i'm using Web Deployment Projects + TFS Build).

Now it works.

So the problem was that the Caching requires a check for the folder. I'm guessing that the account (NetworkSystem) just doesn't allow it to create the folder if it doesn't exist .. even though i manually gave permissions to the root folder (and i assume, children).

Oh well - problem solved. I don't like it .. but it's solved.

Pure.Krome