开发者

Control Caching in IIS7 from C#

I have situation described bellow: In CMS was implemented two presentation server which aren't on same machine. Client want to enable IIS caching only on one machine, but changing manually web.config isn't suggested. So I am planning to make some C# code which will make changes in web.config in order to ensure proper cache settings. Is i开发者_Go百科t possible or exist any other solution ( change other settings, edit other files...) for the problem?


"You can configure the element at the server level in the ApplicationHost.config file or at the site, application, or at the directory level in a Web.config file."

If you have physical access to the server you can run from the console appcmd.exe:

appcmd.exe set config -section:system.webServer/caching /+"profiles.[extension='asp',policy='CacheUntilChange',kernelCachePolicy='CacheUntilChange']" /commit:apphost

Check this link: http://www.iis.net/ConfigReference/system.webServer/caching

EDITED

The first answer to this question says how to configure caching at folder level, the 2nd answer for file level:

How to configure static content cache per folder and extension in IIS7?

If you didn't specify any caching rules at file or folder level, disabling global caching should do it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜