Solved

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

Posted on 2010-08-30
6
997 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

840 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