zoukankan      html  css  js  c++  java
  • 转:IIS aspnet HTTP 压缩 与Ajax

    IIS aspnet HTTP 压缩 与Ajax


    最近在做IIS ASPNET的项目,对首页访问速度要求比较高。
    通过配置AppPool可以有效提高IIS的响应速度。
    启用IIS的HTTP压缩后,对于ASPX的程序处理和Ajax方式调用产生了问题。
    IIS的HTTP压缩配置比较简单不能支持比较灵获得配置。
    我搜 找到了 blowery.Web.HttpCompress(在线文档) 这个在性能上评价还不错。

    配置
    Web.config
      <configSections>
        <sectionGroup name="blowery.web">
          <section name="httpCompress" type="blowery.Web.HttpCompress.SectionHandler,         blowery.Web.HttpCompress"/>
        </sectionGroup>
      </configSections>

    blowery.web
       <blowery.web>
        <httpCompress preferredAlgorithm="gzip" compressionLevel="high">
          <excludedMimeTypes>
            <add type="image/jpeg"/>
            <add type="image/gif"/>
          
    <add type="text/plain"/>  <!--解决Ajax回调不支持压缩格式的问题-->
          

          </excludedMimeTypes>
          <excludedPaths>
            <add path="NoCompress.aspx"/>
          </excludedPaths>
        </httpCompress>
      </blowery.web>


    excludedMimeTypes  包含的在此的Mime类型将不被压缩
    excludedPaths 包含的在此的aspx将不被压缩

    注意源代码中有一处bug,在处理excludePaths时不起作用
                    string realPath = "";
                    try
                    {
                        logger.Debug(app.Request.ApplicationPath);
                        realPath = app.Request.Path.Remove(0, app.Request.ApplicationPath.Length);
                    }
                    catch (Exception ex)
                    {
                        logger.Debug(ex.Message);
                        realPath = "/";
                    }

    经测试 一个35K的页面,可以控制在10~15k大小,这会大大加快传输的速度。
    总体效果不错。


    Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1499862
    、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

    附注:
    在运行微软Internet Information Services (IIS) 6.0的Windows Server 2003系统上,使用GNU zip(Gzip)进行压缩的静态文件可能会不可用或包含有来自Web服务器中其他文件的内容。如果出现这种情况,返回客户端的页面将会生成出错,而且还可能造成访问冲突的现象。
      上述问题可能影响到“Outlook网络访问(OWA)”用户,并可能导致代码错误信息返回到OWA页面上。

      微软已针对上述问题发布了修复补丁,其版本号为831464,大小为430 KB。该补丁对应微软第831464号知识库文章。

      点击这里下载该补丁的简体中文版。

    http://www.cnblogs.com/shanyou/archive/2005/08/20/218927.html
    http://www.cnblogs.com/dudu/archive/2004/12/12/76085.html
    http://blog.joycode.com/moslem/archive/2005/08/19/62173.aspx

    、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
    www.asp.net处的资料
    http://www.asp.net/ControlGallery/Disclaimer.aspx?downloadControl=696&tabindex=2

  • 相关阅读:
    servlet的配置
    getRequestDispatcher()与sendRedirect()的区别
    request.setAttribute()怎么用的?
    <jsp:useBean>元素使用全解
    jsp中使用javabean简单例子
    2-1
    跟我想的一样,已经连续暴跌三天了。
    我的判断很正确
    我靠算个账发现最近打德扑输了好多钱啊,怀疑PokerStars里是不是有好多机器人作弊骗钱呢???
    1-18
  • 原文地址:https://www.cnblogs.com/shiningrise/p/807818.html
Copyright © 2011-2022 走看看