leora
leora

Reputation: 196891

Why am I getting an error in my web.config file

I have the following section added to my web.config:

<system.webServer>
 <caching>
  <profiles>
   <add extension=".html" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
   <add extension=".htm" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
  <add extension=".gif" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
   <add extension=".js" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
   <add extension=".css" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
    <add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
    </profiles>
   </caching>
 </system.webServer> 

which was taken directly from here

but I am getting an error in my web.config, saying:

Unrecognized configuration section system.web/caching/profiles

also, I see this in visual studio: enter image description here

The element caching has invalid child element 'profiles', List of possible expected: cache, outputcache, outputcacheSettings, sqlCacheDependency'

did something about this configuration change as I see alot of examples on the web with this exact configuration?

Upvotes: 0

Views: 957

Answers (2)

curtisk
curtisk

Reputation: 20175

What you show in code example is under <system.webServer>, what you show in your screenshot is under <system.web>, it needs to be under webServer for it to get the profiles option, under system.web like you had it offers all those options that the error you received was talking about, behaves differently depending on where you call it from

Upvotes: 1

amurra
amurra

Reputation: 15411

In your screenshot you have the caching under <system.web> and not <system.webServer> and since profiles is not a valid element under <caching> for <system.web> you will get that error.

Upvotes: 3

Related Questions