0

I have a node.js application running on iisnode running on IIS 10 running on Windows Server 2019.

At one of these layers, there seems to be some caching of javascript files. For example, in my app.js file, I had this:

fs.appendfilesync('log.txt', 'CORS set up.\n');

...which was giving me the error:

appendfilesync is not a function.

I realized I had a typo: it should be camel cased. So I changed it to:

fs.appendFileSync('log.txt', 'CORS set up.\n');

But it kept giving me the same error, even specifying the exact same line and column in the file.

I know the caching is occuring on the server because the error is logged to iisnode's logs and because I leave it for a day and try again the next day and the error no longer occurs.

It's extremely frustrating when I'm trying to fix things on the server and I can't test my fix because it stubbornly won't update the cache.

How can I force iisnode, IIS, or Windows Server 2019 (whichever one is doing the caching, if not more than one) to clear the cache or to not cache?

Thank you.

gib65
  • 1,709
  • 3
  • 24
  • 58
  • If your issue is solved then I request you to mark the helpful suggestion as an answer. This will help other people who face the same issue. – Jalpa Panchal Mar 19 '20 at 08:48

1 Answers1

2

Please make sure you assigned the iis_iusrs and iusr full control permission to the log.txt file.

To disable caching in iis you could follow the below steps:

1)using output caching:

  • Select your site in iis.

  • Double click on output caching feature from the middle pane.

enter image description here

  • Click edit feature setting from the action pane.

  • Uncheck Enable cache and Enable kernel cache.

enter image description here

2)clientCache:

  • Open Internet Information Services (IIS) Manager select your site.

  • In the Home pane, double-click HTTP Response Headers.

enter image description here

  • In the Set Common HTTP Response Headers dialog box, check the box to expire Web content, select the option to expire after a specific interval or at a specific time, and then click OK.

enter image description here

Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26