我在 web.config 中添加了以下部分:
<system.webServer>
<caching>
<profiles>
<add extension=".html" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
<add extension=".htm" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
<add extension=".gif" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
<add extension=".js" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
<add extension=".css" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
<add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
</profiles>
</caching>
</system.webServer>
直接取自这里
但我的 web.config 中出现错误,说:
无法识别的配置部分 system.web/caching/profiles
另外,我在视觉工作室看到这个:
元素缓存具有无效的子元素“配置文件”,可能的预期列表:缓存、输出缓存、输出缓存设置、sqlCacheDependency
当我在网上看到很多具有这种精确配置的示例时,这个配置是否发生了变化?