我有一个web服务的端点,它不会在AJAX请求的性能监视器中获得输出缓存命中,它确实会为非 AJAX请求获得一个输出缓存。
网络配置:
<caching>
<outputCacheSettings >
<outputCacheProfiles>
<add location="Any" name="myCache" duration="3600" varyByParam="*" />
</outputCacheProfiles>
</outputCacheSettings>
</caching>我在配置中遗漏了一个选项吗?我没有包含Javascript,因为我怀疑问题在哪里,因为服务器不应该检查任何头来确定缓存的适配性。
端点:
[AspNetCacheProfileAttribute("myCache")]
[WebGet(ResponseFormat= WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "suburb?name={name}&state={state}&category={category}&bedrooms={bedrooms}&country={country}")]发布于 2014-03-26 13:31:37
当您进行ajax调用时,有可能将其作为缓存: false传递。
当您这样调用时,ajax调用将传递带有额外参数的URL,并且值将是一个随机唯一的数字。由于varyByParam="*"方法接收这个额外的参数并配置输出缓存,因此该方法将永远不会缓存。解决办法是:
抱歉,回复晚了。我刚才看到了这个问题。
https://stackoverflow.com/questions/19131700
复制相似问题