How to Compress JSON with ASP?

2019-01-26 20:01发布

I have a large JSON data string that's 757KB. I tried GZIP'ing it, which successfully reduced file size down to 143KB. But, in it's GZIP'ed state, my JQUERY function can't make use of the compressed JSON data.

Any suggestions on how to compress JSON in an IIS/ASP environment and still be able to use the JSON data in a JQUERY function?

1条回答
趁早两清
2楼-- · 2019-01-26 20:59

Hope this helps:

  • Activate Dynamic Compression
  • Open SystemDir (C:\Windows\System32) and find this file: inetsvr\config\applicationhost.config
  • Find the <dynamicTypes> tag.
    Be sure you have <add mimeType="application/json" enabled="true" /> in the list.
  • Try reducing the amount of data you pass. 757KB is a LOT of information.
    If you pass HTML, you are doing it wrong. Pass the data and render it client side.
    If you are passing plain data, you are probably passing too much of it; try splitting it in more requests, in order to let the user show part of the whole information while still loading it.
查看更多
登录 后发表回答