IIS Express上的GZip响应 [英] GZip response on IIS Express

查看:79
本文介绍了IIS Express上的GZip响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想压缩来自IIS Express驱动的Web应用程序的响应.我们将IIS Express用作本地开发Web服务器,并在登台和构建计算机上使用IIS.我找到了许多有关在IIS上启用压缩响应的指南,但对于IIS Express则没有.甚至有可能吗?

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?

推荐答案

您可以像在IIS中一样在IIS Express中启用压缩.

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

  1. 启动命令提示符并转到IIS Express安装文件夹(%PROGRAMFILES%\IIS Express)

运行以下命令

appcmd设置配置-section:urlCompression/doDynamicCompression:true

appcmd set config -section:urlCompression /doDynamicCompression:true

要为JSON添加压缩,请从IIS Express安装目录运行以下两个命令:

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

appcmd设置配置/section:staticContent/+[fileExtension='.json',mimeType='application/json']

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

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

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

确保重新启动IIS Express.

Make sure to restart IIS Express.

这篇关于IIS Express上的GZip响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆