简体   繁体   中英

Caching issue - ASPX and ASCX files not updating when saved

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM