7

IIS 7.5では、cacheControlMaxAgeを1年に設定しました。

<location path="Content/Images">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
      </staticContent>
    </system.webServer>
  </location>

このガイドによると:有効期限とCache-Controlの設定:ASP.NETの静的リソースのmax-ageヘッダー

ただし、Google PageSpeedツールは、ファイルがキャッシュされていないと言っています。

The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:
* https://local.example.com/Content/Images/image1.png (expiration not specified)
(etc)

なぜ「有効期限が指定されていません」と表示されるのですか?

Webアプリ全体がhttps経由で提供されますが、それが要因ですか?

4

2 に答える 2

5

指定されたパスをContent/Imagesからだけに変更することでこれを解決しましたContent

<location path="Content">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlCustom="public" 
                     cacheControlMode="UseMaxAge" 
                     cacheControlMaxAge="365.00:00:00" />
      </staticContent>
    </system.webServer>
  </location>

したがって、修正されていますが、パスを変更しても、実際に問題が何であったかは明確になりません。

于 2014-03-18T00:39:19.560 に答える
0

Google PageSpeedは、最近行った変更に「追いつく」のに少し時間がかかる場合があります。ページ全体を更新したことを確認し、PageSpeed自体の更新ボタンを押してください。それができない場合、FirefoxでFirebugを使用すると、常にネットタブで正確な結果が得られるようです。ファイルの横にあるプラスアイコンをクリックして、応答ヘッダーを調べます。

于 2013-07-29T17:17:10.537 に答える