1

At some point in the last month, two web application projects that I've been working on have stopped showing updates to aspx and ascx files until IIS is restarted, or the website they belong to is reset.

This seems to be very random and I can't find any reason in the web.config sections that would cause this change.

What are some good places to look for a source to this issue?

Current caching parts of web.config:

Removing the outputCacheProfile and restarting IIS made no difference.

 <caching>
    <outputCacheSettings>
        <outputCacheProfiles>
            <add name="ClientResourceCache" location="None" enabled="true" duration="3600" varyByParam="*" varyByContentEncoding="gzip;deflate"/>
        </outputCacheProfiles>
    </outputCacheSettings>
</caching>

Commening out the staticConent and restarting also made no difference

 <staticContent>
        <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00">
    </clientCache>
 </staticContent>
 <caching>
    <profiles>
        <add extension=".gif" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".png" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".js" policy="DontCache" kernelCachePolicy="DontCache" duration="00:01:00" location="Any" />
        <add extension=".css" policy="DontCache" kernelCachePolicy="DontCache" duration="00:01:00" location="Any" />
        <add extension=".jpg" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
        <add extension=".jpeg" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
    </profiles>
  </caching>

We've also tried adding .ascx and .aspx extensions with CacheUntilChange which made no difference. Other sites with these same settings aren't having the issue.

Edit: Originally this state that there also was no update when the project was built, I haven't personally been able to confirm that issue but was told by another developer that was occurring.

sclarson
  • 4,362
  • 3
  • 32
  • 44

2 Answers2

4

When you are deploying are you deleteing out all data in the publish location and then deploying the new files or just copying and overwriting? I don't think this is code or configuration issue.

Check your bin directory and look for some out of place files with an extension .cache. I have run into this in the past and now I always make sure to do a full delete and deploy whenever I do an update to ensure there are no old files left behind.

If you are using the 'Publish' functionality in Visual Studio make sure to set the 'Delete all existing files prior to publish' option.

Kelsey
  • 47,246
  • 16
  • 124
  • 162
  • It isn't an issue at deployment time, just an annoyance at development time. The project file uses and IIS Site to debug against and as we change aspx and ascx files the new versions aren't being served out. – sclarson Mar 04 '11 at 17:08
  • @sparks so how are you debugging it? Running it inside VS or do you have all the files somewhere that you have IIS mapped to and are debugging against? – Kelsey Mar 04 '11 at 17:55
  • Site is running in IIS pointing at the same files that visual studio uses. So debugging is visual studio 2010 as a web application project using local IIS (not cassini). – sclarson Mar 04 '11 at 20:01
  • 1
    @sparks this personal preference but I debug in VS and I have IIS attached to a seperate directory locally that I publish to, to test things outside of VS. I ran into a similar problem when I had IIS point to the same location as where my code lives instead of a published location. It might be pre-compiling your code for you where if you publish you web application to a different directory, there is no code that IIS can compile since the directory only contains the application output (eg no .cs files) – Kelsey Mar 04 '11 at 21:35
  • 1
    Problem isn't resolved but I think it may be something related to code in the project and not settings or be a deeper IIS issue. Accepting this because I like the local deploy dev idea. – sclarson Mar 09 '11 at 15:15
  • I found the best answer to this problem to be Jester's solution here https://stackoverflow.com/questions/16137457/asp-net-temporary-files-cleanup – Bennett Elder Jan 08 '18 at 15:51
1

Response.Cache.SetNoStore();

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.Expires = -1;

add this is in your applications begin request event in global.asax.cs file

  • Added this to Application_BeginRequest. Still have to rebuild to see any change to an aspx or ascx file. – sclarson Mar 04 '11 at 17:15