IIS caching output of pages

N

Nick Gilbert

Hi,

Our development web server (Win 2003 Server) seems to be caching the
output of various files (CSS and .aspx files) if they have no query
string. The moment you put a question mark in the URL, it's fine.

The problem is that if you modify a file, it still shows you the old
file unless you restart the website or IIS itself. It's definitely not
the browser that's caching the files - IIS is actually serving the wrong
file.

Is there some way to disable this? Why doesn't IIS realise when the file
on it's local filesystem has been modified and reload it?

I had a similar problem once before where my workstation had it's clock
a few minutes into the future, but this time it seems to be a different
problem as now all our machines are synchronised and are set to exactly
the same time.

I'd be greatful if someone can tell me how to solve this very annoying
problem.

Thanks,

Nick...
 
C

Chad Z. Hower aka Kudzu

Nick Gilbert said:
Our development web server (Win 2003 Server) seems to be caching the
output of various files (CSS and .aspx files) if they have no query
string. The moment you put a question mark in the URL, it's fine.

Have you proven its your webserver and not the browsers, or proxies?
 
S

Steven Cheng[MSFT]

Hi Nick,


Thanks for posting in the community!
From your description, you found that the files on your IIS Serve such as
(css or aspx files) are always cached and won't be the latest version if it
is modified and requested by client unless appending querystring after the
request url, yes?
If there is anything I misunderstood, please feel free to let me know.

Based on my experience, the such static files and resources such as images,
css files , js files ...etc are all by default cached on the client in the
temporary foler rather than on the serverside. For example, if a user visit
a certain page and the page contains some images and refernce some certain
css or js files. Then the browser will download these resources and cached
in the local disk and next time the page is refreshed (request again) these
resoures files won't be downloaded again from serverside but retrieved from
local cache disk.
So as for your situation, I think the problem you met is likely caused by
the client's cache. And as you've mentioned that this can be avoided( force
the browser to download the file from serversdie everytime the page is
requested) if you append a querystring(need to be different everytime)
after the page's url. So if you'd like the page's refernced resources files
to be downloaded everytime from serverside(the latest version), I think you
can append a tempstamp as querystring after the certain resource file's
url. For example,
if we use a css file as below:
src="common.css"
then now, we replace it as this:
src="common.css?version=<% timestamp %>"

Thus, everytime the page is requested, the css file will be retireved from
serverside (its latest version). How do you think of this?

In addition ,here are some tech articles on browser's cache:
#HOWTO: Prevent Caching in Internet Explorer
http://support.microsoft.com/?id=234067

#How to Use Pragma: No-cache with IIS and IE
http://support.microsoft.com/?id=165150

Hope they're also helpful.



Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
N

Nick Gilbert

Thanks Steven, but it's definitely IIS that's caching the web pages -
not the client. We have verified this by disabling caching in IE,
looking at the pages from other machines or browsers and by telnetting
into the server and looking at the raw HTTP response (which shows the
old data). The *only* way to force the new page to display, is to
restart the website in IIS or reboot the whole server.

Why is IIS (or the file system) caching the pages and how can we stop
this?

Nick...
 
S

Steven Cheng[MSFT]

Hi Nick,


Thanks for your response. Based on my further research, there does seems to
have a certain issue on the IIS Server, but it is used to focus on win2000
server, here is the kb article on it:

#FIX: IIS Does Not Refresh the File Cache for Non-Virtual Root Directories
http://support.microsoft.com/?id=329459

Please have a check to see whether it could provide some help or clues on
this issue. In addtion, I've searched some other articles on setting cache
via page's http header:

#How to Modify the Cache-Control HTTP Header When You Use IIS
http://support.microsoft.com/?id=247404

#HOW TO: Prevent Web Caching in Windows 2000
http://support.microsoft.com/?id=311006


Hope they're also helpful.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
N

Nick Gilbert

Thanks, but these articles pertain to Windows 2000 and we are actually
running Windows Server 2003 Standard Edition. We are still
experiencing this problem so if you have any other ideas, please let
me know!

Nick...
 
S

Steven Cheng[MSFT]

Hi Nick,

Thank you for the response. Regarding on the issue, I am
finding proper resource to assist you and we will update as soon as posible.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security(This posting is provided "AS IS",
with no warranties, and confers no rights.)
 
S

Steven Cheng[MSFT]

Hi Nick,

After further research, I found that there seems an issue on IIS6's
caching, here is the detailed description on it:

----------------------------------------------------------------
In Microsoft Internet Information Services 6.0, if your Web site is
configured for both an IP address and host headers, any change that you
make to the static content does not appear immediately.

CAUSE
=====

This problem occurs because of the way that the content is stored in the
Http.sys cache.

RESOLUTION
==========

Hotfix information
------------------
A supported hotfix is now available from Microsoft, but it is only intended
to correct the problem that is described in this article. Only apply it to
systems that are experiencing this specific problem. This hotfix may
receive additional testing. Therefore, if you are not severely affected by
this problem, Microsoft recommends that you wait for the next Windows
Server 2003 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support
Services to obtain the hotfix. For a complete list of Microsoft Product
Support Services phone numbers and information about support costs, visit
the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;[LN];CNTACTMS:
http://support.microsoft.com/default.aspx?scid=fh;[LN];CNTACTMS

Note In special cases, charges that are ordinarily incurred for support
calls may be canceled if a Microsoft Support Professional determines that a
specific update will resolve your problem. The usual support costs will
apply to additional support questions and issues that do not qualify for
the specific update in question.


Restart requirement

You must restart your computer after you apply this hotfix


File information
The English version of this hotfix has the file attributes (or later) that
are listed in the following table. The dates and times for these files are
listed in coordinated universal time (UTC). When you view the file
information, it is converted to local time. To find the difference between
UTC and local time, use the "Time Zone" tab in the Date and Time tool in
Control Panel.

Date Time Version Size File name
------------------------------------------------------
10-Dec-2003 00:37 5.2.3790.110 334,336 Http.sys
10-Dec-2003 01:18 5.2.3790.110 27,648 Httpapi.dll
10-Dec-2003 01:18 6.0.3790.110 338,432 W3core.dll

Note If you are also experiencing the symptoms that Microsoft Knowledge
Base article 832911 describes, apply this hotfix before you apply hotfix
832911.

--------------------------------------------------------

However, this issue is still in testing. Not sure whether your problem due
to it.

In addtion, you should also verify whether or not this is a kernel mode
caching issue you're dealing with by temporarily disabling the kernel mode
cache (UriEnableCache=0, etc.). For details on this, refer to
http://support.microsoft.com/?id=820129.

Please check out the above items. Hope they are helpful.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
N

Nick Gilbert

Steven,

Thanks, but the post does not include the URL of the hotfix, and the KB
article ID it refers to doesn't exist (832911). In fact there doesn't
seem to be a section on the knowledge base at all for IIS 6 - it stops
at IIS 5. If this is a known problem, then surely I shouldn't have to
pay to get a simple hotfix? Additionally, do you know the URL or ID of
the article that you posted (as below) as I can't find that on the
knowledge base either.

Thanks,

Nick...
Hi Nick,

After further research, I found that there seems an issue on IIS6's
caching, here is the detailed description on it:

----------------------------------------------------------------
In Microsoft Internet Information Services 6.0, if your Web site is
configured for both an IP address and host headers, any change that you
make to the static content does not appear immediately.

CAUSE
=====

This problem occurs because of the way that the content is stored in the
Http.sys cache.

RESOLUTION
==========

Hotfix information
------------------
A supported hotfix is now available from Microsoft, but it is only intended
to correct the problem that is described in this article. Only apply it to
systems that are experiencing this specific problem. This hotfix may
receive additional testing. Therefore, if you are not severely affected by
this problem, Microsoft recommends that you wait for the next Windows
Server 2003 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support
Services to obtain the hotfix. For a complete list of Microsoft Product
Support Services phone numbers and information about support costs, visit
the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;[LN];CNTACTMS:
http://support.microsoft.com/default.aspx?scid=fh;[LN];CNTACTMS

Note In special cases, charges that are ordinarily incurred for support
calls may be canceled if a Microsoft Support Professional determines that a
specific update will resolve your problem. The usual support costs will
apply to additional support questions and issues that do not qualify for
the specific update in question.


Restart requirement

You must restart your computer after you apply this hotfix


File information
The English version of this hotfix has the file attributes (or later) that
are listed in the following table. The dates and times for these files are
listed in coordinated universal time (UTC). When you view the file
information, it is converted to local time. To find the difference between
UTC and local time, use the "Time Zone" tab in the Date and Time tool in
Control Panel.

Date Time Version Size File name
------------------------------------------------------
10-Dec-2003 00:37 5.2.3790.110 334,336 Http.sys
10-Dec-2003 01:18 5.2.3790.110 27,648 Httpapi.dll
10-Dec-2003 01:18 6.0.3790.110 338,432 W3core.dll

Note If you are also experiencing the symptoms that Microsoft Knowledge
Base article 832911 describes, apply this hotfix before you apply hotfix
832911.

--------------------------------------------------------

However, this issue is still in testing. Not sure whether your problem due
to it.

In addtion, you should also verify whether or not this is a kernel mode
caching issue you're dealing with by temporarily disabling the kernel mode
cache (UriEnableCache=0, etc.). For details on this, refer to
http://support.microsoft.com/?id=820129.

Please check out the above items. Hope they are helpful.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
S

Steven Cheng[MSFT]

Hi Nick,

Thanks for your response. As for the KB, since it is still under reviewing
so we can't get it via the public url. And about the hotfix, it has been
mentioned in it that you need to call the PSS for it:
------------------------------------------------
To resolve this problem immediately, contact Microsoft Product Support
Services to obtain the hotfix. For a complete list of Microsoft Product
Support Services phone numbers and information about support costs, visit
the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;[LN];CNTACTMS:
http://support.microsoft.com/default.aspx?scid=fh;[LN];CNTACTMS

---------------------------------------------------
So the url only provide the address to find the contact info of the PSS.

In addition, have you also checked another suggestions in my former reply?
-------------------------------
In addtion, you should also verify whether or not this is a kernel mode
caching issue you're dealing with by temporarily disabling the kernel mode
cache (UriEnableCache=0, etc.). For details on this, refer to
http://support.microsoft.com/?id=820129.
---------------------------------

Thanks.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top