I am making an installer for my web application. My web application makes heavy use of CSS and JS, so I want to enable both static and dynamic HttpCompression for IIS7 / 7.5.
2 steps required:
- I can change the tag
web.config, put <httpcompression>, this is normal. - DynamicContentCompression must be enabled in Windows Feature for httpCompression to work.
Static HttpCompression is enabled by default in IIS7 and IIS7.5, but dynamic HttpCompression is not enabled by default (although it is available). I can do it manually by including:, Start/ControlPanel/ProgramsAndFeatures/TurnWindowsFeatures on or Off/IIS/WWW Service/Performance features/Dynamic Content Compressionbut How can I programmatically enable it in this Windows feature? I can use PowerShell, C # in my installer.
Any idea how I can do this? Thank.
source
share