我怎样才能得到ASP.NET AJAX来使用gzip COM pression发送其JSON repsonse? [英] How can I get ASP.NET AJAX to send its JSON repsonse with GZip compression?

查看:91
本文介绍了我怎样才能得到ASP.NET AJAX来使用gzip COM pression发送其JSON repsonse?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IIS7启用COM pression和它的作品如预期上除了由ASP.NET AJAX构建的所有答复。我有一个Web服务,将数据提供给客户端。当Web服务的直接调用,这是正确的COM pressed。然而,当它是通过ASP.NET AJAX调用,JSON响应不是玉米pressed

I have compression enabled within IIS7 and it works as expected on all responses except for those constructed by ASP.NET AJAX. I have a web service that provides data to the client. When the web service is called directly, it is properly compressed. However, when it is called via ASP.NET AJAX, the JSON response is not compressed.

我怎样才能得到ASP.NET AJAX发送它使用gzip COM pression JSON响应?

How can I get ASP.NET AJAX to send its JSON response with GZip compression?

推荐答案

这应该工作开箱。为了验证我的ASP.NET AJAX JSON响应用gzip COM pression:

This should work out of the box. To verify that my ASP.NET AJAX JSON responses use GZip compression:

  1. 下载提琴手(2.1.9版本 最新的)

  1. Download Fiddler (version 2.1.9 is the latest)

启用提琴手在IE 7:工具 - > Fiddler2

Enable Fiddler in IE 7: Tools -> Fiddler2

由于所有的流量是通过代理路由,您需要设置提琴手应用接受编码:gzip在HTTP标头。规则 - >应用gzip编码

As all traffic is routed through the proxy, you need to set Fiddler to apply the accept-encoding:Gzip in the HTTP header. Rules -> Apply GZip Encoding

通过提琴手访问您的网站。如果你的网站是在本地主机上,IE7将通过提琴手不要将这个。菲德勒2.1.8有一个很棒的功能映射本地主机(127,0.0.1)到 HTTP://ipv4.fiddler HTTP://ipv6.fiddler

Visit your site through fiddler. If your site is on localhost, IE7 won't route this through fiddler. Fiddler 2.1.8 has a neat feature that maps localhost (127,0.0.1) to http://ipv4.fiddler and http://ipv6.fiddler

查找在提琴手会议的ASMX要求。

Find the asmx request in the Fiddler sessions.

要验证请求是用gzip编码,在顶部面板查看请求报头。您应该看到客户:接受编码:gzip,紧缩

To verify that the request was made with the gzip encoding, look at the Request-Headers in the top panel. You should see "Client: accept-encoding: gzip,deflate"

要验证响应发送用gzip编码,看响应报头的底部面板。您应该看到交通运输:内容编码:gzip

To verify that the response was sent with gzip encoding, look at the Response-Headers in the bottom panel. You should see "Transport: Content-Encoding: gzip"

我有IIS 7,无需额外配置安装在Vista商业版SP1,我的项目是使用ASP.NET AJAX与标准的Web服务。

I have IIS 7 installed on Vista Business SP1 with no additional configuration, my project is using ASP.NET AJAX with standard web-services.

希望帮助!

这篇关于我怎样才能得到ASP.NET AJAX来使用gzip COM pression发送其JSON repsonse?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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