我有一个应用程序在IIS中通过ISAPI扩展运行,输出JSON文件基于inputURL(它与RESTful接口 – URL的格式为http://domain/path/to/resource.json )。
该应用程序工作正常,但我无法获得IIS输出caching为我生成的文件工作。
在我的web.config中有:
<system.webServer> ... <caching> <profiles> <add extension=".json" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="00:00:30" /> </profiles> </caching> </system.webServer>
我也试过使用*但是这也不起作用。
任何想法,为什么这是行不通的? 谢谢!
默认情况下,caching在ISAPI筛选器上是禁用的,我不相信它可以通过GUI启用。 安装ISAPI筛选器并通过修改web.config的<isapiFilters>部分或使用appcmd.exe来启用cachingfunction。
appcmd.exe示例:
appcmd.exe set config -section:system.webServer/isapiFilters /+"[name='YourJsonIsapi',path='c:\yourpath\YourJsonIsapi.dll',enabled='True',enableCache='True']" /commit:apphost
web.config示例:
<configuration> <system.webServer> <isapiFilters> <filter name="YourJsonIsapi" enabled="true" enableCache="true" path="C:\yourpath\YourJsonIsapi.dll" /> </isapiFilters> </system.webServer> </configuration>