Solved

Windows 2008 Server with IIS 7. Uses old (cahced?) pages.

Posted on 2010-08-30
6
987 Views
Last Modified: 2012-08-13
Using ASP .Net 4.0 and IIS 7...

We have noticed that after putting new pages on our Windows 2008 Server running IIS 7, that the web server still uses the old page. For instance, we have code behind written in C# that appends an additional URL parameter when a button is clicked. Even though we have copied this new "aspx.cs" page to the server it is still using the old one from it's cache.

I have tried the following:

"touching" (saving) the "web.config" file
Recycling the App Pool
Renaming the "cs" file, hit the page, then rename it back.

Any other ideas on how to force IIS to reload/recompile?

0
Comment
Question by:dbaGrant
  • 3
  • 3
6 Comments
 
LVL 14

Expert Comment

by:wolfman007
ID: 33568207
As long as you have not precompiled your ASP.NET application using Visual Studio before deploying it then IIS should be recompiling your website every time a change to the source files is made.

Compiling on First Request

By default, ASP.NET Web pages and code files are compiled dynamically when users first request a resource, such as an ASP.NET page (.aspx file), from a Web site. After pages and code files have been compiled the first time, the compiled resources are cached, so that subsequent requests to the same page are extremely efficient.

Recompiling on Change

Any changes to a dynamically compiled file will automatically invalidate the file's cached compiled assembly and trigger recompilation of all affected resources. The next time a request to the code is made, ASP.NET recognizes that the code has changed and recompiles the affected resources of the Web application.

from

Understanding ASP.NET Dynamic Compilation
http://msdn.microsoft.com/en-us/library/ms366723.aspx

If you are not seeing any changes in your ASP.NET website when you are making changes it might be that the pages are being cached in your browser. Try using SHIFT + F5 to force the browser to reload the ASP.NET page direct from the web server.
0
 
LVL 14

Expert Comment

by:wolfman007
ID: 33568239
Sorry its CTRL + F5 to force a refresh

http://www.refreshyourcache.com/en/cache/
0
 

Author Comment

by:dbaGrant
ID: 33572089
Hmm. After a day it is still using the old "aspx.cs" file. We are not "deploying" the changes, we are simply doing a filesystem copy of the file (the new aspx.cs) file.

This is very strang. I know there are no compile errors, we have compiled it locally. Besides, it is a simple append to a redirected URL (something like "&ID=123") that is triggered by a button handler event.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:dbaGrant
ID: 33572100
I forgot to mention that we dont precompile.
0
 
LVL 14

Accepted Solution

by:
wolfman007 earned 500 total points
ID: 33594615
Is it possible that someone has setup Output Caching on your server?

Internet Information Services 7 (IIS 7) includes an output cache feature that can cache dynamic PHP content (or output from your Microsoft® ASP.NET or classic ASP, or other dynamic pages) in memory. This can yield enormous performance improvements, since the script used to generate the dynamic output does not need to run for each request.

IIS supports two ways to invalidate dynamic content:

Use a simple timeout period - the configuration property is CacheForTimePeriod.

Detect a change to the underlying resource - the configuration property is CacheUntilChange. Use this type of invalidation scheme only when you want the cache flushed when the underlying resource changes.

from

Configure IIS 7 Output Caching
http://learn.iis.net/page.aspx/710/configure-iis-7-output-caching/

http://learn.iis.net/page.aspx/154/walkthrough-iis-70-output-caching/

It might be that someone has setup output caching and specified a time period, and your page has been cached. So you are not getting the new version when you make a change.

The cache is fairly easy to configure using the user interface feature in the new IIS administration tool.

1. From the Start menu, click Administrative Tools, and then click Internet Information Services (IIS) Manager.

2. In the tree view on the left side, find your application/website.

3.Select the Output Caching menu item.

Check to see if there are any output caching rules already setup.

If you want to force IIS 7 not to cache aspx pages then you can add a rule for aspx pages.

4. In the right column, click Add in the Action menu. You can add your output caching rule here.

5. In the File name extension field, for example, type .aspx, and then select User-mode caching.

6. The chose one of the radio buttons i.e. using file changes, at time intervals, or prevent all caching.

If you want to test that caching is your problem then choose prevent all caching and see if your page changes as expected.
0
 

Author Comment

by:dbaGrant
ID: 33719891
I will try this. Something else we noticed, is if we use the Visual Studio Solution that is stored in the directory of the web appliation, then the changes take effect immediately. (But, if we say make the changes on a dev server, then copy just the new aspx files, they are cached).

The Output Caching IS setup, but there are no rules. So, does that mean it is caching everything (or nothing)?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now