Pergunta

Scenario: At our company, we have enabled httpCompression for our website. This website (call it as master website) and its preview version both are hosted on the same web server. Preview version is used for testing.

The compression settings in the web.config file are

 <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
  <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
  <dynamicTypes>
    <add mimeType="text/*" enabled="true"/>
    <add mimeType="message/*" enabled="true"/>
    <add mimeType="application/javascript" enabled="true"/>
    <add mimeType="*/*" enabled="false"/>
  </dynamicTypes>
  <staticTypes>
    <add mimeType="text/*" enabled="true"/>
    <add mimeType="message/*" enabled="true"/>
    <add mimeType="application/javascript" enabled="true"/>
    <add mimeType="*/*" enabled="false"/>
  </staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="true"/>

According to this article, compressed files are temporarily saved/cached to the directory specified in the config settings. In my case, it's %SystemDrive%\inetpub\temp\IIS Temporary Compressed Files. I do not have access to the web server to look at those compressed files. so here are my questions.

  1. How the compressed files are saved/cached or named for different web sites?
  2. Let's say I use same compression directory for both web sites (preview and master). If a user requests a static file from preview website, it is compressed and cached in the directory. Now, another user requests the same file but from master web site. Does the server sends the compressed file of the preview website or it compresses the file again and saves to the directory?
Foi útil?

Solução

IIS Creates a complex directory structure such as follows:

%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files\(compressionType)\(AppPool)\(WebSite)\compressed files

It will not share the compressed version of the same files across web applications.

So to answer your question, there will be 2 compression versions of the file.

PS - You could have also turned on compression locally on IIS 7.5 and saw this structure locally.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top