none
请问Azure中website如何使用gzip压缩(或者类似的技术)? RRS feed

答案

  • 您好,

    可以使用。

    您需要在webconfig中对该功能进行配置,如下:

    添加这段代码,表示您在应用程序级别对您的动态和静态内容进行压缩:

    <system.webServer>
           <urlCompression doStaticCompression="true" doDynamicCompression="true" />
     </system.webServer>

    然后再指定您要压缩的动态或者金泰的MIME:

    httpCompression>
      <dynamicTypes>
        <clear />
        <add enabled="true" mimeType="text/*"/>
        <add enabled="true" mimeType="message/*"/>
        <add enabled="true" mimeType="application/x-javascript"/>
        <add enabled="true" mimeType="application/javascript"/>
        <add enabled="true" mimeType="application/json"/>
        <add enabled="false" mimeType="*/*"/>
        <add enabled="true" mimeType="application/atom+xml"/>
        <add enabled="true" mimeType="application/atom+xml;charset=utf-8"/>
      </dynamicTypes>
      <staticTypes>
        <clear />
        <add enabled="true" mimeType="text/*"/>
        <add enabled="true" mimeType="message/*"/>
        <add enabled="true" mimeType="application/javascript"/>
        <add enabled="true" mimeType="application/atom+xml"/>
        <add enabled="true" mimeType="application/xaml+xml"/>
        <add enabled="true" mimeType="application/json"/>
        <add enabled="false" mimeType="*/*"/>
      </staticTypes>
     </httpCompression>

    建议您参考这几个post:

    http://stackoverflow.com/questions/7171434/iis-7-5-gzip-compression-at-shared-hosting/7171979#7171979

    https://social.msdn.microsoft.com/Forums/azure/en-US/890b6d25-f7dd-4272-8970-da7798bcf25d/httpcompression-settings-on-a-simple-azure-website?forum=windowsazurewebsitespreview

    希望能够帮助到您。

    Regards,

    Will

    如果您想进一步了解Windows Azure, Windows Azure 官网欢迎您的访问


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    2015年2月22日 6:28
    版主

全部回复

  • 您好,

    可以使用。

    您需要在webconfig中对该功能进行配置,如下:

    添加这段代码,表示您在应用程序级别对您的动态和静态内容进行压缩:

    <system.webServer>
           <urlCompression doStaticCompression="true" doDynamicCompression="true" />
     </system.webServer>

    然后再指定您要压缩的动态或者金泰的MIME:

    httpCompression>
      <dynamicTypes>
        <clear />
        <add enabled="true" mimeType="text/*"/>
        <add enabled="true" mimeType="message/*"/>
        <add enabled="true" mimeType="application/x-javascript"/>
        <add enabled="true" mimeType="application/javascript"/>
        <add enabled="true" mimeType="application/json"/>
        <add enabled="false" mimeType="*/*"/>
        <add enabled="true" mimeType="application/atom+xml"/>
        <add enabled="true" mimeType="application/atom+xml;charset=utf-8"/>
      </dynamicTypes>
      <staticTypes>
        <clear />
        <add enabled="true" mimeType="text/*"/>
        <add enabled="true" mimeType="message/*"/>
        <add enabled="true" mimeType="application/javascript"/>
        <add enabled="true" mimeType="application/atom+xml"/>
        <add enabled="true" mimeType="application/xaml+xml"/>
        <add enabled="true" mimeType="application/json"/>
        <add enabled="false" mimeType="*/*"/>
      </staticTypes>
     </httpCompression>

    建议您参考这几个post:

    http://stackoverflow.com/questions/7171434/iis-7-5-gzip-compression-at-shared-hosting/7171979#7171979

    https://social.msdn.microsoft.com/Forums/azure/en-US/890b6d25-f7dd-4272-8970-da7798bcf25d/httpcompression-settings-on-a-simple-azure-website?forum=windowsazurewebsitespreview

    希望能够帮助到您。

    Regards,

    Will

    如果您想进一步了解Windows Azure, Windows Azure 官网欢迎您的访问


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    2015年2月22日 6:28
    版主
  • 非常感谢!!
    2015年2月22日 8:09