Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IIS keeps pages cached, whatever.

33 views
Skip to first unread message

Kaplan@discussions.microsoft.com Daniel Kaplan

unread,
Jun 27, 2005, 10:19:03 AM6/27/05
to
OK we're running our website on IIS 6.
today i tried to upload a new javascript file to the website.
I went to view the website to check whether the update had taken place.
When the web page loaded i found that the new javascript was not being run.
We've had this problem before so i went into IIS on the server and stopped
and started the site.
Nothing, the old Javascript was still displayed.
I then deleted the javascript file completely from the server and restarted
the site.
Still the old javascript was displayed (despite me having deleted this script)

I checked from the web server terminal to make sure the files had been
deleted, and they had.

I then tried stopping and starting ALL sites on the web server, using the
command:
net stop iisadmin

followed by net start w3svc

still the old script was displayed

i then uploaded the new javascript again and set the expiration time to
immediate on both the javascript and the page that called it

i restarted the site again

still the old javascript was displayed.

Finally i set the whole site to expire immediatly and restarted the site.
No surprises here, the old script was still there.

Help, There's got to be a way to get my script to update

I'd really rather not turn the server off as we are a multinational company,
we have 14 websites being run on the server and the marketing dpartement will
open me a new port if they notice i've taken down every website the company
has.

Kristofer Gafvert [MVP]

unread,
Jun 27, 2005, 12:17:49 PM6/27/05
to
Hello,

In almost all cases when this happens, it is because of a client side
cache.

If you upload the js-file, and request it directly using a non-caching
client (for example WFetch from IIS 6.0 resource kit tools), do you get
the old, or the new file?

Also make sure that you empty the cache in your client, if you choose to
use that.


--
Regards,
Kristofer Gafvert (IIS MVP)
www.gafvert.info - My Articles and help
www.ilopia.com

Daniel Kaplan

unread,
Jun 27, 2005, 12:29:02 PM6/27/05
to
I've cleared my client side cache several times, i've tried it on other PCs

Kristofer Gafvert [MVP]

unread,
Jun 27, 2005, 2:02:42 PM6/27/05
to
In IIS, caching can be at either kernel-mode, or user-mode.

HTTP.sys caches responses in the kernel-mode cache. For a file to get into
this cache, it has to be accessed twice within 10 seconds (default). Every
120 seconds a flush algorithm runs, clearing out files that have not been
accessed within 120 seconds. This flush algorithm is also run whenever IIS
receives a change notification for a file.

To clear this cache, you can restart HTTP.sys by typing this in a command
prompt:

NET STOP /y HTTP

After that, start the W3SVC service.

The user-mode cache is in the worker process. So to clear that cache, all
you need to do is restart the worker process, which will happen if you
restart the W3SVC service as you have already done. And of course, this
cache is also cleared for any file that is changed. It also clears out
files that has not been accessed for 30 seconds (default value).

Beyond that, there is a file system cache. A reverse proxy can also cache
the file, ISPs may cache files and regular proxy can cache files.

May i ask where the file is stored? On the local file system, or a remote
machine?

Daniel Kaplan

unread,
Jun 28, 2005, 6:02:02 AM6/28/05
to
i'm afraid that this did not fix the problem. I must admit it's quite
worrying that the problem is still there 24 hours later. usually a few
restarts of IIS fixes the problem.
it's odd because when i go and log onto the web server (physically stand
infront of it and connect through the terminal) and look in windows explorer
the files are all correct and up to date. it's just IIS that see's the old
ones.

To answer your queston. the files are stored locally on the web server.

Basically we use a content management system, and rather than giving users
direct access to the website (we don't trust them) we have identical copies
of the websites located on our intranet server. the users update these
copies, then at 5am every morning a batch file is run to copy the files
accross from the intranet server to the web server. For some reason IIS still
keeps it's cache after the files are copied across (yes we have checked that
we did infact copy the pages accross from the intranet server to the web
server).

How do you clear the file system cache.

If i find a solution i'll let you know

William Tasso

unread,
Jun 28, 2005, 7:30:20 AM6/28/05
to
Daniel Kaplan"" <Daniel...@discussions.microsoft.com> wrote:

> ...


> we did infact copy the pages accross from the intranet server to the web
> server).
>
> How do you clear the file system cache.

FWIW: I have seen this problem exactly once on IIS6

> If i find a solution i'll let you know

Yes, that would be good. A system recycle worked for us, but something a
little less drastic would be useful.

--
William Tasso

Kristofer Gafvert [MVP]

unread,
Jun 28, 2005, 4:07:02 PM6/28/05
to
As far as i know, you cannot clear the file system cache unless you reboot
the machine. But i am not an expert on how the file system in Windows
works.

David Wang [Msft]

unread,
Jun 29, 2005, 4:39:12 AM6/29/05
to
If the following does not "flush" the cache, the issue is not with IIS:
NET STOP /y HTTP & NET START W3SVC

All cache resources are associated with w3wp.exe, and when w3wp.exe goes
down, all in-process state (including cache) is destroyed. w3wp.exe also
flushes the HTTP.SYS kernel cache when it winds down. Even if w3wp.exe is
killed or unexpectedly terminated, HTTP.SYS will detect this and flush the
associated kernel cache entries.

Is the content being served by the w3wp.exe process on a local harddrive to
the process, or is it a UNC / network share?

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"William Tasso" <spamb...@tbdata.com> wrote in message
news:op.ss2vkum...@tbdata.com...

Trent Jones

unread,
Jun 29, 2005, 1:11:58 PM6/29/05
to
Whenever I have seen this happen, somebody is usually editing the files in
the wrong location! :)

- SG

"Daniel Kaplan" <Daniel Kap...@discussions.microsoft.com> wrote in message
news:BB922390-52F8-4B8D...@microsoft.com...

0 new messages