How to override HttpErrors section in Web.Config - ASP.NET MVC3

I am trying to add custon 404 pages as per answer of this question

ASP.NET MVC 404 handling and IIS7

by adding


under tag in my Web.Config file.

But I am getting following error

Module: CustomErrorModule 
Notification: SendResponse 
Handler: System.Web.Mvc.MvcHandler 
Error Code: 0x80070021 
Config Error: 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".  


 Config Source
  153:       
  154:   

I also tried to override the locking based on http://learn.iis.net/page.aspx/145/how-to-use-locking-in-iis-70-configuration ( Task 2 )

by adding location tag in the Web.config

as following


....
....

  
        
            
        
  

but I am getting the same error.

How should I configure httpErrors element in Web.config so it works

I am using IIS 7 , VS 2010 , ASP.NET MVC3

Update:

I am able to get rid of the locked error

if i modify applicationHost.config file and change

this

to

but ideally I do not want to change applicationHost.config file and want to override it from the Web.config file

10
задан Community 23 May 2017 в 10:29
поделиться