How do I prevent IIS 7.5 from caching symlink content? How do I prevent IIS 7.5 from caching symlink content? windows windows

How do I prevent IIS 7.5 from caching symlink content?


This problem drove me nuts for like a month a while back. You have to disable IIS caching in the registry, as far as I know this isn't documented anywhere for IIS 7 but instead is an old IIS 5 trick that still works. You can either turn the below into a .reg file and import it or you can just navigate to the section and add it manually. I recommend rebooting after changing this parameter, I'm not sure if IIS picks it up after just an iisreset.

Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\InetInfo\Parameters]"DisableMemoryCache"=dword:1


I was previously able to fix this issue on IIS7 with Banin's fix. Since then, I have moved to Windows 10 with IIS 10, and suffered the same problem again. DisableMemoryCache did not help.

I then disabled kernel caching, and for now, that seems to fix the issue (I'm sorry for the Dutch in the screenshot):

IIS dialog box screenshot


Banin's solution worked for me. The issue was resolved after changing registry parameter and resetting IIS. The C# program below (you can use LINQPad to run it) will help you reproduce the issue:

using System.IO;using System.Net;void Main() {  var virtualPath = "JunctionPoint/sample.js";  var physicalPath = $@"C:\IISROOT\JunctionPoint\{virtualPath}";  for (int i = 0; i < 100; i++) {       File.WriteAllText(physicalPath, i.ToString());    Console.Write(i + "=");    var client = new WebClient();    string html = client.DownloadString($"http://localhost/{virtualPath}");    Console.WriteLine(html);    if (i.ToString() != html) {      Console.WriteLine("Issue reproduced!!!");    }  }}