GZip response on IIS Express

2019-01-31 20:36发布

I want to compress responses coming from my IIS Express driven web application. We're using IIS Express as local development webserver and IIS on staging and on our build machines. I have found many guides on enabling gzipped responses on IIS but none for IIS Express. Is it even possible?

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-01-31 20:55

You can enable compression in IIS Express, just like for IIS.

  1. Start command prompt and go to IIS Express installation folder (%PROGRAMFILES%\IIS Express)

  2. Run following command

appcmd set config -section:urlCompression /doDynamicCompression:true

To add compression for JSON run the following two commands from the IIS Express installation directory:

appcmd set config /section:staticContent /+[fileExtension='.json',mimeType='application/json']

appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json',enabled='True']" /commit:apphost

Make sure to restart IIS Express.

查看更多
登录 后发表回答