1

I have this randomly occurring problem where IIS Express does not recognize when I make a change to an ASP page. It serves up the previous version of the page instead.

I can work around this problem by re-editing the page, making a small change, then undoing the change and re-saving the file. But that's annoying...

So far I've only seen this happen with Classic ASP pages, not the other files (html, js, css...) in my project. I know that IIS caches ASP pages and updates the cache when the file is updated, so something must be preventing IIS from recognizing when these files change. I just don't know what that could be.

In case it matters I'm using Visual Studio 2013, IIS Express 7.1.1557 on Windows 7.

My web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.web>
        <compilation debug="true" targetFramework="4.5" />
        <customErrors mode="Off" />
    </system.web>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
    </system.webServer>
</configuration>
Keith
  • 18,957
  • 10
  • 75
  • 119
  • Make sure you web.config does not have output caching enabled. IIS/Express does not cache asp by default, its a feature that needs to be turned on. Share your web.config and we can get a better idea of what is poppin. – Frank Jun 07 '15 at 17:54
  • @Frank See update to question – Keith Jun 07 '15 at 19:12
  • 1
    are you sure that its IIS that is caching the page and not your browser? What happens if you include the following on the top of the page Try that, and referesh the page a few times. If it doesnt change (meaning the clock is fozen) then you have output caching enabled, but looking at your web.config i would assume that its not at the site level, but at the server level. Also please try if the times freeze by adding a different querystring to the url. page.asp?test=some-random-text-to-see-if-page-loads-123423423 – Frank Jun 08 '15 at 06:01
  • @Frank It is definitely IIS, not the browser. When debugging I will see the old version of the page in the debugger. I did find that output caching is enabled in applicationHost.config so I have disabled it and I'm testing to see if that fixes the problem. – Keith Jun 08 '15 at 11:26
  • @Frank Forget what I said. The problem is still happening even with output caching disabled. I just happened to be lucky enough to avoid the problem for a week but it reared its ugly head again today. – Keith Jun 18 '15 at 18:47

3 Answers3

2

I have the exact same behavior. So far, this seems to have fixed it:

In the applicationhost.config of IISExpress (%userprofile%\My Documents\IISExpress\config), under <system.webServer>, I had a caching disabled, but not kernel caching. Here is what I have now:

<caching enabled="false" enableKernelCache="false">
</caching>

So far, it seems to do the trick. I hope it will help you out as well.

It seems to have a small negative impact on performance, but in my case it is worth it.

EDIT

After using it for some time, I started getting the cached pages served again. Then I tried closing VS, make sure IISExpress was stopped, open VS again, and start the website without debugging (Ctrl+F5), and so far no caching issues.

One difference though... My version of IISExpress.exe is 8.0.8418.0 (and Visual Studio is 12.0.21005.1 REL). I hope this helps you, Keith, as I know how annoying this bug is. Good luck.

Robert
  • 21
  • 4
  • Good suggestion, however it didn't solve the problem for me. – Keith Nov 17 '15 at 14:39
  • Did you try running without debug (Ctrl+F5) ? Seems to work for me. – Robert Nov 27 '15 at 14:29
  • Yep, I see the same problem whether I'm using Start Debugging or Start Without Debugging. I'm going to try upgrading my version of IIS Express though. That sounds promising, thank you. – Keith Nov 27 '15 at 14:34
1

I have not experienced this problem since upgrading IIS Express from version 7 to 10 (download here).

See here for how to detect your version of IIS Express.

Community
  • 1
  • 1
Keith
  • 18,957
  • 10
  • 75
  • 119
0

Not only do you have to set this setting:

<caching enabled="false" enableKernelCache="false"></caching>

as Robert wrote, but the one below, too:

<section name="caching" overrideModeDefault="Deny" />

to keep caching off at all times.