How can I turn on DynamicCompression feature of IIS programmatically?
- by LockeVN
I'm making an installer program for my web application. My web application uses CSS and JS heavily, so I want to enable both Static and Dynamic HttpCompression for IIS7/7.5.
It needs 2 steps:
I can modified the web.config, put <httpcompression> tag, it's ok.
DynamicContentCompression must be turned on in Windows Feature to make httpCompression work.
Static HttpCompression is enable by default in IIS7 and IIS7.5, but Dynamic HttpCompression is not enable by default (although it's available). I can do manually by turn on: Start/ControlPanel/ProgramsAndFeatures/TurnWindowsFeatures on or Off/IIS/WWW Service/Performance features/Dynamic Content Compression, but How can I programmatically turn it on that Windows Feature?
I can use PowerShell, C# in my installer.
Any idea how I might be able to do this? Thanks.