How to enable DynamicCompression software feature in IIS?

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.

+5
source share
4 answers

So I would do this:

dis / online / enable-feature / featurename: IIS-HttpCompressionDynamic

dis allows you to check the return code of a command, allowing you to verify that it worked (or has already been installed)

+6
source

These PowerShell commands will add dynamic compression.

Import-Module ServerManager
Add-WindowsFeature Web-Server, Web-Dyn-Compression

Do not forget to run as administrator or have administrator rights.

+4
source

: ....

Greg , . , , ... .

, CPU. , . , . , , , , , .

, Google, .

, , IIS-. , IIS... .

... , ?::

Start /w pkgmgr /iu:IIS-HttpCompressionDynamic

?? :)

here is another article with lots of options ...

+1
source

You can enable this using the appcmd tool. From the command line:

C:\windows\system32\inetsrv\appcmd set config /section:urlCompression /doDynamicCompression:True

Or if you want to execute it from a PowerShell script:

& $env:windir\system32\inetsrv\appcmd set config -section:urlCompression /doDynamicCompression:true

You will need administrative privileges.

0
source

All Articles