6

We use Windows server 2008 R2 Enterprise And IIS7.5.7600.16385, and i deployed a simple web (asp.net mvc, c#, .net framework 4.5.1) on the server. a controller like below, and *.cshtml only output a datetime:

public class DetailController : Controller
{
    [OutputCache(Duration = 300, VaryByParam = "id")]
    public ActionResult Index(int id)
    {
        return View();
    }
}

when i first request the url http://localhost:80/Detail/Index?id=3 , the response is correct:

Cache-Control:public, max-age=300
Date:Mon, 24 Oct 2016 12:11:59 GMT
Expires:Mon, 24 Oct 2016 12:16:51 GMT
Last-Modified:Mon, 24 Oct 2016 12:11:51 GMT

but, when i request the url again(ctrl+f5), the max-age incorrect (then the response is from the server cache):

Cache-Control:public, max-age=63612908450
Date:Mon, 24 Oct 2016 12:16:34 GMT
Expires:Mon, 24 Oct 2016 12:20:50 GMT
Last-Modified:Mon, 24 Oct 2016 12:15:50 GMT

i don't know why the max-age so large, and how it generated, it will reconvert when the output cache expired (ctrl+f5). In my production env, the incorrect max-age cause a url link click read the content from browser's disk cache.

any one know how and how to fixed it?

Divyang Desai
  • 7,483
  • 13
  • 50
  • 76
mofee
  • 135
  • 1
  • 9
  • it seems a bug of .net framework 4.6.2 (394806), our server .net framework is 4.6.2 not 4.5.1. And i try in a server which installed .net framework 4.5.1, it work well, then i update to 4.6.2, now the issue occurs – mofee Oct 26 '16 at 07:22
  • Note that this bug has also hit StackExchange itself. See [Nick Craver's answer here](https://meta.stackexchange.com/a/293496/300549) and [his (angry) comment on the bug report](https://github.com/Microsoft/dotnet/issues/330#issuecomment-292651969). – isanae Apr 11 '17 at 08:00

2 Answers2

5

This is a known issue and a bug is open for .NET 4.6.2 coming with KB151864.

Please see here for additional details: https://github.com/Microsoft/dotnet/issues/330

This is going to be fixed in .NET 4.6.3. I currently don't know if a fix will be made available earlier for 4.6.2.

The only known workaround at present is to downgrade and remove KB151864, when possible.

NOTE: the bug is affecting ONLY the compilation of the "max-age" attribute in the Cache-Control header for the cached responses. The actual caching mechanism and lifetime expiration is working.

albigi
  • 91
  • 3
  • It was fixed on 4.7, no news on backporting to 4.6.x yet. – isanae Apr 11 '17 at 08:01
  • Looks like they fixed it in [May 2017 Preview of Quality Rollup](https://blogs.msdn.microsoft.com/dotnet/2017/05/17/net-framework-may-2017-preview-of-quality-rollup/) for 4.6.2. – cflyer Jun 15 '17 at 22:56
  • It says: `This release is no longer recommended / available.` `A bug was found in the May 2017 Preview of Quality Rollup installer that is incompatible with the .NET Framework 4.7 installer. The bug only surfaces when the May 2017 Preview of Quality Rollup (this update) and the .NET Framework 4.7 are installed, in that order.` – Offir Jul 19 '17 at 09:00
0

I just spoke with Microsoft Support team and this is what they responded me:

The suggested workaround is to downgrade the frame work from 4.6.2 to 4.6.1 by uninstalling the update KB31511864.

Go to control panel -> programs -> Programs and Feature -> Installed Updates. And remove KB3151864, that will fix this issue.

Offir
  • 3,252
  • 3
  • 41
  • 73