无法获取静态资源的缓存(CSS,图像)在 Azure Web App 中确实有效
Cannot get caching for static recources (CSS, images) does to work in Azure Web App
我有一个 Azure 帐户,其中有一个处于开发初期的 Web 应用程序。
我正在使用 Google Pagespeed Insights 来测试任何性能问题 ( https://developers.google.com/speed/pagespeed/insights/ )
它告诉我没有为我的静态资源设置缓存。因此,我通过添加以下代码在 web.config 文件中为我的 Web 应用程序启用了缓存:
<system.webServer>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMaxAge="00.12:00:00" cacheControlMode="UseMaxAge" />
</staticContent>
</system.webServer>
但这不起作用(我用 Chrome 开发工具检查 headers)。
对我做错了什么有什么想法吗?
谢谢。
没关系,搞清楚了。
必须从 web.config 中取出以下代码:
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
它来自我之前设置的 ASP.NET 5 MVC 项目。
我有一个 Azure 帐户,其中有一个处于开发初期的 Web 应用程序。
我正在使用 Google Pagespeed Insights 来测试任何性能问题 ( https://developers.google.com/speed/pagespeed/insights/ )
它告诉我没有为我的静态资源设置缓存。因此,我通过添加以下代码在 web.config 文件中为我的 Web 应用程序启用了缓存:
<system.webServer>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMaxAge="00.12:00:00" cacheControlMode="UseMaxAge" />
</staticContent>
</system.webServer>
但这不起作用(我用 Chrome 开发工具检查 headers)。
对我做错了什么有什么想法吗? 谢谢。
没关系,搞清楚了。 必须从 web.config 中取出以下代码:
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
它来自我之前设置的 ASP.NET 5 MVC 项目。