Asp.net 从移动应用程序调用WCF缓存时不工作
我使用以下代码实现了WCF缓存:Asp.net 从移动应用程序调用WCF缓存时不工作,asp.net,rest,web-services,wcf,outputcache,Asp.net,Rest,Web Services,Wcf,Outputcache,我使用以下代码实现了WCF缓存: iService.vb <OperationContract()> <AspNetCacheProfile("CacheFor60Seconds")> <WebGet(RequestFormat:=WebMessageFormat.Json, UriTemplate:="some-url?id={id}", BodyStyle:=WebMessageBodyStyle.Bare, ResponseFormat:=WebMessage
iService.vb
<OperationContract()>
<AspNetCacheProfile("CacheFor60Seconds")>
<WebGet(RequestFormat:=WebMessageFormat.Json, UriTemplate:="some-url?id={id}", BodyStyle:=WebMessageBodyStyle.Bare, ResponseFormat:=WebMessageFormat.Json)>
Web.Config
<system.web>
<caching>
<outputCache enableOutputCache="true"></outputCache>
<outputCacheSettings>
<outputCacheProfiles>
<add name="CacheFor60Seconds" duration="60" varyByParam="id"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" minFreeMemoryPercentageToActivateService="0" multipleSiteBindingsEnabled="true">
</serviceHostingEnvironment>
</system.serviceModel>
当我使用浏览器调用RESTAPI时,该解决方案可以正常工作。响应被缓存。但是,当我从移动应用程序调用RESTAPI时,响应不会被缓存。我遗漏了什么吗?事实证明,出于某种原因,我不得不在Web.config中包含移动应用程序中使用/调用的另一个参数:
<add name="CacheFor60Seconds" duration="60" varyByParam="id;param2"/>
事实证明,出于某种原因,我不得不在Web.config中包含移动应用程序中使用/调用的另一个参数:
<add name="CacheFor60Seconds" duration="60" varyByParam="id;param2"/>