1

I wanted to add cache header to browser on IIS. I found this: IIS 7.5 and images not being cached

<staticContent>
    <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
</staticContent>
<httpProtocol>
    <customHeaders>
        <add name="Cache-Control" value="public" />
    </customHeaders>
</httpProtocol>

This solves cache problem that Google warned about on PageSpeed test: https://developers.google.com/speed/pagespeed/insights/

But also this causes 500.19 error, and it says that: "The configuration section 'staticContent' cannot be read because it is missing a section declaration"

My web.config file was look like that:

<?xml version="1.0"?>
<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
        <compilation debug="false"></compilation>
        <authentication mode="Windows"/>
    </system.web>
    <system.webServer>
        <httpErrors errorMode="Custom">
            <remove statusCode="404" subStatusCode="-1"/>
            <error statusCode="404" prefixLanguageFilePath="" path="/rewrite.asp" responseMode="ExecuteURL"/>
        </httpErrors>
    </system.webServer>
</configuration>

How to prevent this error?

Community
  • 1
  • 1
Digerkam
  • 1,826
  • 4
  • 24
  • 39

0 Answers0