locked
httpCompression settings RRS feed

  • Question

  • User-1388963663 posted
    <system.webServer>
      <urlCompression doStaticCompression="true" doDynamicCompression="true"
      dynamicCompressionBeforeCache="true" />
      <httpCompression>
        <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" dynamicCompressionLevel="4"  />
      </httpCompression>
    </system.webServer>

    I have this code in my web.config for an ASP.NET 4.5 website running in IIS 7.5

    I wonder if having an empty <httpCompression>  section (without directory="..." and other internal elements like  and such) will cause issue or the default attributes/elements for this section are correctly read from IIS applicationHost.config

    What I'm trying to do here is just set the compression on and the compression ratio in the web.config without overriding or clearing other default values. Could I remove name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" from the scheme as well in the web.config and just leave staticCompressionLevel and dynamicCompressionLevel in the scheme tag? Would those attributes be read from applicationHost.config

    Thursday, December 27, 2012 9:36 AM

Answers

  • User-166373564 posted

    Hi manight

    Great post!

    if in my <httpCompression> section in the web.config I write <scheme staticCompressionLevel="9" dynamicCompressionLevel="4" /> without specifying the attributes name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" wich are already in the root applicationHost.config will this cause issue?

    name="gzip" or name ="deflate" is required string attribute, specifies the name of the compression scheme.

    Dll is required string attribute, specifies the fully qualified file system path and file name of the compression DLL associated with the compression scheme. The World Wide Web Publishing Service (WWW service) must be restarted before any changes to this attribute take effect.

    It means that you don’t leave out name attribute and dll attribute.

    hope it helps you,

    Kind regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 3, 2013 1:58 AM
  • User-166373564 posted

    Hi manight

    manight

    If I open a <httpCompression> section in my web.config without specifying the attribute directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" wich is already set in the applicationHost.config file, will this cause issue?

    As the link above mentioned, directory is optional string attribute, specifies the directory where compressed versions of static files are temporarily stored and cached. The default value is %SystemDrive%\inetpub\temp\IIS Temporary Compressed Files.

    It means that you could leave out this directory attribute.

    hope it helps you,

    Kind regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 3, 2013 2:08 AM

All replies

  • User-166373564 posted

    Hi manight

    if having an empty <httpCompression>  section (without directory="..." and other internal elements like  and such)

    Compressed files are temporarily saved/cached to the directory specified in the config settings, it's %SystemDrive%\inetpub\temp\IIS Temporary Compressed Files.

    Could I remove name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" from the scheme

    Schema, optional element. Specifies the compression scheme (Gzip or Deflate) IIS uses to compress client requests.

    You could refer the HTTP Compression <httpCompression> to learn the detailed mechnism and function about httpCompression.

    hope it helps you,

    Kind regards

     

    Wednesday, January 2, 2013 1:23 AM
  • User-1388963663 posted

    Thank you Angie for your kind answer. I understand now that my question was not clear enough.

    I know the things you said and what attributes or tags do. My question is different and I'll try to explain better.

    Asp.net websites inherits IIS config from applicationHost.config located at  C:\Windows\System32\inetsrv\config.
    In this "root" applicationHost.config there are already options set for httpCompression like for example:

    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
                <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" dynamicCompressionLevel="4" />
                <staticTypes>
                    <add mimeType="text/*" enabled="true" />
                    <add mimeType="message/*" enabled="true" />
                    <add mimeType="application/x-javascript" enabled="true" />
                    <add mimeType="application/atom+xml" enabled="true" />
                    <add mimeType="application/xaml+xml" enabled="true" />
                    <add mimeType="*/*" enabled="false" />
                </staticTypes>
                <dynamicTypes>
                    <add mimeType="text/*" enabled="true" />
                    <add mimeType="message/*" enabled="true" />
                    <add mimeType="application/x-javascript" enabled="true" />
                    <add mimeType="*/*" enabled="false" />
                </dynamicTypes>
    </httpCompression>

    Now what I'm asking is this. What happens if I override those settings in my local web.config, without specifying ALL the attributes or elements?

    If I open a <httpCompression> section in my web.config without specifying the attribute directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" wich is already set in the applicationHost.config file, will this cause issue?

    And also.. if in my <httpCompression> section in the web.config I write <scheme staticCompressionLevel="9" dynamicCompressionLevel="4" /> without specifying the attributes name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" wich are already in the root applicationHost.config will this cause issue?

    I just want to override some of the settings, letting alone the others like the default directories for example. That's the question.

     

    Wednesday, January 2, 2013 8:01 AM
  • User-166373564 posted

    Hi manight

    Great post!

    if in my <httpCompression> section in the web.config I write <scheme staticCompressionLevel="9" dynamicCompressionLevel="4" /> without specifying the attributes name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" wich are already in the root applicationHost.config will this cause issue?

    name="gzip" or name ="deflate" is required string attribute, specifies the name of the compression scheme.

    Dll is required string attribute, specifies the fully qualified file system path and file name of the compression DLL associated with the compression scheme. The World Wide Web Publishing Service (WWW service) must be restarted before any changes to this attribute take effect.

    It means that you don’t leave out name attribute and dll attribute.

    hope it helps you,

    Kind regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 3, 2013 1:58 AM
  • User-166373564 posted

    Hi manight

    manight

    If I open a <httpCompression> section in my web.config without specifying the attribute directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" wich is already set in the applicationHost.config file, will this cause issue?

    As the link above mentioned, directory is optional string attribute, specifies the directory where compressed versions of static files are temporarily stored and cached. The default value is %SystemDrive%\inetpub\temp\IIS Temporary Compressed Files.

    It means that you could leave out this directory attribute.

    hope it helps you,

    Kind regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 3, 2013 2:08 AM