IIS Express overly caching classic ASP pages

2019-03-06 14:14发布

问题:

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>

回答1:

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.



回答2:

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.



回答3:

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.