Setting Expires header on IIS 7
Setting Expires header on IIS 7
am 17.11.2007 06:44:57 von George.V.Reilly
I'm trying to set an Expires header through the IIS 7 UI in Vista. The
documentation talks about the HTTP Response Headers in Features View,
but I see no such feature on any of my sites.
I tried
appcmd list config "cozitest"
where "cozitest" is the name of my website. It fell over on the
"extension" attribute in the entry in my web.config:
type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
warningLevel="1"/>
>
Commenting it out made appcmd happy, but it didn't make any difference
to the UI.
I then tried
appcmd set config "cozitest/images" /section:staticContent /
clientCache.cacheControlMode:UseExpires /clientCache.httpExpires:"Fri,
28 Jul 2008 15:30:00 UTC"
but I got
ERROR ( message:Can not set attribute "cacheControlMode" to value
"UseExpires"..
Reason: This configuration section cannot be used at this path. This
happens when the section is locked at a parent level. Locking is
either by default (overrideModeDefault="Deny"), or set explicitly by a
location tag with overrideMode="Deny" or the legacy
allowOverride="false".
.. )
Trying
appcmd list config | grep -i override
yields nothing.
At which point I'm going home for the night.
/George V. Reilly, Seattle
Re: Setting Expires header on IIS 7
am 17.11.2007 11:46:48 von David Wang
On Nov 16, 9:44 pm, "George V. Reilly"
wrote:
> I'm trying to set an Expires header through the IIS 7 UI in Vista. The
> documentation talks about the HTTP Response Headers in Features View,
> but I see no such feature on any of my sites.
>
> I tried
> appcmd list config "cozitest"
> where "cozitest" is the name of my website. It fell over on the
> "extension" attribute in the entry in my web.config:
>
>
>
>
>
>
> type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0,
> Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
>
>
>
>
>
>
>
> warningLevel="1"/>
>
>
>
>
>
> Commenting it out made appcmd happy, but it didn't make any difference
> to the UI.
>
> I then tried
>
> appcmd set config "cozitest/images" /section:staticContent /
> clientCache.cacheControlMode:UseExpires /clientCache.httpExpires:"Fri,
> 28 Jul 2008 15:30:00 UTC"
>
> but I got
>
> ERROR ( message:Can not set attribute "cacheControlMode" to value
> "UseExpires"..
> Reason: This configuration section cannot be used at this path. This
> happens when the section is locked at a parent level. Locking is
> either by default (overrideModeDefault="Deny"), or set explicitly by a
> location tag with overrideMode="Deny" or the legacy
> allowOverride="false".
> . )
>
> Trying
> appcmd list config | grep -i override
> yields nothing.
>
> At which point I'm going home for the night.
>
> /George V. Reilly, Seattle
When you get errors about sections being locked at a parent level, it
means that the sections needs to be "unlocked" to allow delegated
admin access at the child level.
You will need to do one of the three thinsg that the error response
mentions -- either change the default delegated admin from "deny" to
"allow", or explicitly use a location tag to allow override or change
the override mode to "allow". Or make the modifications in
applicationHost.config in non-delegated-admin fashion (i.e. like how
one changes config in metabase).
It's a bit tricky, but this is left-over from ASP.Net's concepts that
have to be carried forward for compatibility.
Once you do that configuration, your command should work. I tried it
out myself.
//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
Re: Setting Expires header on IIS 7
am 19.11.2007 19:38:15 von George.V.Reilly
On Nov 17, 2:46 am, David Wang wrote:
> On Nov 16, 9:44 pm, "George V. Reilly"
> wrote:
>
>
>
> > I'm trying to set anExpiresheader through the IIS 7 UI in Vista. The
> > documentation talks about the HTTP Response Headers in Features View,
> > but I see no such feature on any of my sites.
>
> > I tried
> > appcmd list config "cozitest"
> > where "cozitest" is the name of my website. It fell over on the
> > "extension" attribute in the entry in my web.config:
>
> >
> >
> >
> >
> >
> > type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0,
> > Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
> >
> >
> >
> >
> >
> >
> >
> > warningLevel="1"/>
> >
>
> >
> >
>
> > Commenting it out made appcmd happy, but it didn't make any difference
> > to the UI.
>
> > I then tried
>
> > appcmd set config "cozitest/images" /section:staticContent /
> > clientCache.cacheControlMode:UseExpires /clientCache.httpExpires:"Fri,
> > 28 Jul 2008 15:30:00 UTC"
>
> > but I got
>
> > ERROR ( message:Can not set attribute "cacheControlMode" to value
> > "UseExpires"..
> > Reason: This configuration section cannot be used at this path. This
> > happens when the section is locked at a parent level. Locking is
> > either by default (overrideModeDefault="Deny"), or set explicitly by a
> > location tag with overrideMode="Deny" or the legacy
> > allowOverride="false".
> > . )
>
> > Trying
> > appcmd list config | grep -i override
> > yields nothing.
>
> > At which point I'm going home for the night.
>
> > /George V. Reilly, Seattle
>
> When you get errors about sections being locked at a parent level, it
> means that the sections needs to be "unlocked" to allow delegated
> admin access at the child level.
>
> You will need to do one of the three thinsg that the error response
> mentions -- either change the default delegated admin from "deny" to
> "allow", or explicitly use a location tag to allow override or change
> the override mode to "allow". Or make the modifications in
> applicationHost.config in non-delegated-admin fashion (i.e. like how
> one changes config in metabase).
>
> It's a bit tricky, but this is left-over from ASP.Net's concepts that
> have to be carried forward for compatibility.
>
> Once you do that configuration, your command should work. I tried it
> out myself.
>
> //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David. Wang
> //
Thanks, David.
I changed system.webServer/staticContent/overrideModeDefault to
"Allow" in config\applicationHost.config and then did an iisreset, but
it makes no difference. The "appcmd set config ..." fails with the
same error.
I think I need slightly more explicit directions. I was in your league
when it came to IIS 6 and below, but I'm an IIS 7 neophyte
Regardless of this, shouldn't I have "HTTP Response Headers" as a
feature in the IIS Manager?
/George
Re: Setting Expires header on IIS 7
am 21.11.2007 08:55:28 von David Wang
On Nov 19, 10:38 am, "George V. Reilly"
wrote:
> On Nov 17, 2:46 am, David Wang wrote:
>
>
>
>
>
> > On Nov 16, 9:44 pm, "George V. Reilly"
> > wrote:
>
> > > I'm trying to set anExpiresheader through the IIS 7 UI in Vista. The
> > > documentation talks about the HTTP Response Headers in Features View,
> > > but I see no such feature on any of my sites.
>
> > > I tried
> > > appcmd list config "cozitest"
> > > where "cozitest" is the name of my website. It fell over on the
> > > "extension" attribute in the entry in my web.config:
>
> > >
> > >
> > >
> > >
> > >
> > > type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0,
> > > Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > warningLevel="1"/>
> > >
>
> > >
> > >
>
> > > Commenting it out made appcmd happy, but it didn't make any difference
> > > to the UI.
>
> > > I then tried
>
> > > appcmd set config "cozitest/images" /section:staticContent /
> > > clientCache.cacheControlMode:UseExpires /clientCache.httpExpires:"Fri,
> > > 28 Jul 2008 15:30:00 UTC"
>
> > > but I got
>
> > > ERROR ( message:Can not set attribute "cacheControlMode" to value
> > > "UseExpires"..
> > > Reason: This configuration section cannot be used at this path. This
> > > happens when the section is locked at a parent level. Locking is
> > > either by default (overrideModeDefault="Deny"), or set explicitly by a
> > > location tag with overrideMode="Deny" or the legacy
> > > allowOverride="false".
> > > . )
>
> > > Trying
> > > appcmd list config | grep -i override
> > > yields nothing.
>
> > > At which point I'm going home for the night.
>
> > > /George V. Reilly, Seattle
>
> > When you get errors about sections being locked at a parent level, it
> > means that the sections needs to be "unlocked" to allow delegated
> > admin access at the child level.
>
> > You will need to do one of the three thinsg that the error response
> > mentions -- either change the default delegated admin from "deny" to
> > "allow", or explicitly use a location tag to allow override or change
> > the override mode to "allow". Or make the modifications in
> > applicationHost.config in non-delegated-admin fashion (i.e. like how
> > one changes config in metabase).
>
> > It's a bit tricky, but this is left-over from ASP.Net's concepts that
> > have to be carried forward for compatibility.
>
> > Once you do that configuration, your command should work. I tried it
> > out myself.
>
> > //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David. Wang
> > //
>
> Thanks, David.
>
> I changed system.webServer/staticContent/overrideModeDefault to
> "Allow" in config\applicationHost.config and then did an iisreset, but
> it makes no difference. The "appcmd set config ..." fails with the
> same error.
>
> I think I need slightly more explicit directions. I was in your league
> when it came to IIS 6 and below, but I'm an IIS 7 neophyte
>
> Regardless of this, shouldn't I have "HTTP Response Headers" as a
> feature in the IIS Manager?
>
> /George- Hide quoted text -
>
> - Show quoted text -
You can open %windir%\system32\inetsrv\config\applicationHost.config ,
find the section definition for "staticContent" near the top of it,
and it'll have an "Deny" in it. Change it to Allow, and delegated
access should be enabled. At that point, your appcmd command should
work.
//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
Re: Setting Expires header on IIS 7
am 22.11.2007 01:46:38 von George.V.Reilly
On Nov 20, 11:55 pm, David Wang wrote:
> On Nov 19, 10:38 am, "George V. Reilly"
> wrote:
>
>
>
> > On Nov 17, 2:46 am, David Wang wrote:
>
> > > On Nov 16, 9:44 pm, "George V. Reilly"
> > > wrote:
>
> > > > I'm trying to set anExpiresheader through the IIS 7 UI in Vista. The
> > > > documentation talks about the HTTP Response Headers in Features View,
> > > > but I see no such feature on any of my sites.
>
> > > > I tried
> > > > appcmd list config "cozitest"
> > > > where "cozitest" is the name of my website. It fell over on the
> > > > "extension" attribute in the entry in my web.config:
>
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0,
> > > > Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > warningLevel="1"/>
> > > >
>
> > > >
> > > >
>
> > > > Commenting it out made appcmd happy, but it didn't make any difference
> > > > to the UI.
>
> > > > I then tried
>
> > > > appcmd set config "cozitest/images" /section:staticContent /
> > > > clientCache.cacheControlMode:UseExpires /clientCache.httpExpires:"Fri,
> > > > 28 Jul 2008 15:30:00 UTC"
>
> > > > but I got
>
> > > > ERROR ( message:Can not set attribute "cacheControlMode" to value
> > > > "UseExpires"..
> > > > Reason: This configuration section cannot be used at this path. This
> > > > happens when the section is locked at a parent level. Locking is
> > > > either by default (overrideModeDefault="Deny"), or set explicitly by a
> > > > location tag with overrideMode="Deny" or the legacy
> > > > allowOverride="false".
> > > > . )
>
> > > > Trying
> > > > appcmd list config | grep -i override
> > > > yields nothing.
>
> > > > At which point I'm going home for the night.
>
> > > > /George V. Reilly, Seattle
>
> > > When you get errors about sections being locked at a parent level, it
> > > means that the sections needs to be "unlocked" to allow delegated
> > > admin access at the child level.
>
> > > You will need to do one of the three thinsg that the error response
> > > mentions -- either change the default delegated admin from "deny" to
> > > "allow", or explicitly use a location tag to allow override or change
> > > the override mode to "allow". Or make the modifications in
> > > applicationHost.config in non-delegated-admin fashion (i.e. like how
> > > one changes config in metabase).
>
> > > It's a bit tricky, but this is left-over from ASP.Net's concepts that
> > > have to be carried forward for compatibility.
>
> > > Once you do that configuration, your command should work. I tried it
> > > out myself.
>
> > > //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David. Wang
> > > //
>
> > Thanks, David.
>
> > I changed system.webServer/staticContent/overrideModeDefault to
> > "Allow" in config\applicationHost.config and then did an iisreset, but
> > it makes no difference. The "appcmd set config ..." fails with the
> > same error.
>
> > I think I need slightly more explicit directions. I was in your league
> > when it came to IIS 6 and below, but I'm an IIS 7 neophyte
>
> > Regardless of this, shouldn't I have "HTTP Response Headers" as a
> > feature in the IIS Manager?
>
> > /George- Hide quoted text -
>
> > - Show quoted text -
>
> You can open %windir%\system32\inetsrv\config\applicationHost.config ,
> find the section definition for "staticContent" near the top of it,
> and it'll have an "Deny" in it. Change it to Allow, and delegated
> access should be enabled. At that point, your appcmd command should
> work.
>
> //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David. Wang
> //
Thanks. For the record, I had to modify the line that looked like:
I had earlier modified this line:
>
I'm still getting If-Modified-Since GETs from IE6. I probably need to
mess with some of the Caching headers too.
/George
Re: Setting Expires header on IIS 7
am 22.11.2007 01:47:38 von George.V.Reilly
On Nov 20, 11:55 pm, David Wang wrote:
> On Nov 19, 10:38 am, "George V. Reilly"
> wrote:
>
>
>
> > On Nov 17, 2:46 am, David Wang wrote:
>
> > > On Nov 16, 9:44 pm, "George V. Reilly"
> > > wrote:
>
> > > > I'm trying to set anExpiresheader through the IIS 7 UI in Vista. The
> > > > documentation talks about the HTTP Response Headers in Features View,
> > > > but I see no such feature on any of my sites.
>
> > > > I tried
> > > > appcmd list config "cozitest"
> > > > where "cozitest" is the name of my website. It fell over on the
> > > > "extension" attribute in the entry in my web.config:
>
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0,
> > > > Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > warningLevel="1"/>
> > > >
>
> > > >
> > > >
>
> > > > Commenting it out made appcmd happy, but it didn't make any difference
> > > > to the UI.
>
> > > > I then tried
>
> > > > appcmd set config "cozitest/images" /section:staticContent /
> > > > clientCache.cacheControlMode:UseExpires /clientCache.httpExpires:"Fri,
> > > > 28 Jul 2008 15:30:00 UTC"
>
> > > > but I got
>
> > > > ERROR ( message:Can not set attribute "cacheControlMode" to value
> > > > "UseExpires"..
> > > > Reason: This configuration section cannot be used at this path. This
> > > > happens when the section is locked at a parent level. Locking is
> > > > either by default (overrideModeDefault="Deny"), or set explicitly by a
> > > > location tag with overrideMode="Deny" or the legacy
> > > > allowOverride="false".
> > > > . )
>
> > > > Trying
> > > > appcmd list config | grep -i override
> > > > yields nothing.
>
> > > > At which point I'm going home for the night.
>
> > > > /George V. Reilly, Seattle
>
> > > When you get errors about sections being locked at a parent level, it
> > > means that the sections needs to be "unlocked" to allow delegated
> > > admin access at the child level.
>
> > > You will need to do one of the three thinsg that the error response
> > > mentions -- either change the default delegated admin from "deny" to
> > > "allow", or explicitly use a location tag to allow override or change
> > > the override mode to "allow". Or make the modifications in
> > > applicationHost.config in non-delegated-admin fashion (i.e. like how
> > > one changes config in metabase).
>
> > > It's a bit tricky, but this is left-over from ASP.Net's concepts that
> > > have to be carried forward for compatibility.
>
> > > Once you do that configuration, your command should work. I tried it
> > > out myself.
>
> > > //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David. Wang
> > > //
>
> > Thanks, David.
>
> > I changed system.webServer/staticContent/overrideModeDefault to
> > "Allow" in config\applicationHost.config and then did an iisreset, but
> > it makes no difference. The "appcmd set config ..." fails with the
> > same error.
>
> > I think I need slightly more explicit directions. I was in your league
> > when it came to IIS 6 and below, but I'm an IIS 7 neophyte
>
> > Regardless of this, shouldn't I have "HTTP Response Headers" as a
> > feature in the IIS Manager?
>
> > /George- Hide quoted text -
>
> > - Show quoted text -
>
> You can open %windir%\system32\inetsrv\config\applicationHost.config ,
> find the section definition for "staticContent" near the top of it,
> and it'll have an "Deny" in it. Change it to Allow, and delegated
> access should be enabled. At that point, your appcmd command should
> work.
>
> //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David. Wang
> //
Thanks. For the record, I had to modify the line that looked like:
I had earlier modified this line:
>
I'm still getting If-Modified-Since GETs from IE6. I probably need to
mess with some of the Caching headers too.
/George