caching - 如何阻止 Windows Server 2019 上的 iisnode 缓存我的 javascript 文件?
问题描述
我有一个在 iisnode 上运行的 node.js 应用程序,该应用程序在 Windows Server 2019 上运行的 IIS 10 上运行。
在其中一层,似乎有一些 javascript 文件的缓存。例如,在我的 app.js 文件中,我有这个:
fs.appendfilesync('log.txt', 'CORS set up.\n');
...这给了我错误:
appendfilesync is not a function.
我意识到我有一个错字:它应该是驼色的。所以我把它改成:
fs.appendFileSync('log.txt', 'CORS set up.\n');
但它一直给我同样的错误,甚至在文件中指定完全相同的行和列。
我知道缓存正在服务器上发生,因为错误已记录到 iisnode 的日志中,并且因为我将其放置一天,第二天再试一次,错误不再发生。
当我试图修复服务器上的东西并且我无法测试我的修复时,这非常令人沮丧,因为它顽固地不会更新缓存。
如何强制 iisnode、IIS 或 Windows Server 2019(无论哪个正在执行缓存,如果不超过一个)清除缓存或不缓存?
谢谢你。
解决方案
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.
Click edit feature setting from the action pane.
Uncheck Enable cache and Enable kernel cache.
2)clientCache:
Open Internet Information Services (IIS) Manager select your site.
In the Home pane, double-click HTTP Response Headers.
- 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.
推荐阅读
- javascript - 如何在 React-Native 中创建 Action-Sheet/Bottom-Sheet 样式的抽屉?
- powershell - PowerShell 脚本没有像我想要的那样复制
- allocator - 寻找 Dobb 博士 2003/04/01 文章中提供的完整 SharedAllocator 源
- java - 从不同窗口输入后的Java更新对象
- node.js - Node JS 适合作为即时消息服务吗?MongoDB适合作为数据库吗?
- python - 为什么内部“for循环”在代码中不起作用?
- php - 发布网站后如何确定用户角色?
- excel - 我需要编写一个用户表单并应用一些不同的 If 语句来在数据库中创建一个单元格值
- c# - c# FileInfo 类在 SSIS 脚本任务 Directory.GetFiles SearchOption.TopDirectoryOnly 被忽略
- django - 将 Django SessionStore 使用的字符数从 32 扩展到 64