I have modified my web.config file in my asp.net web application so that I am showing a custom error page:
<configuration>
<system.web>
...snip
<customErrors mode="On" defaultRedirect="WebForms/ErrorPage.aspx">
<error statusCode="404" redirect="WebForms/ErrorPageNotFound.aspx" />
</customErrors>
</system.web>
</configuration>
When I run the site on IIS I get the following error:
Error code: 0x800700b7
Config section 'system.web/customErrors' already defined.
Sections must only appear once per config file.
See the help topic <location> for exceptions
Clearly I have some config hierarchy at play here but I don't know which file I need to look at (I have 276 web.config files on my machine) - can someone point me in the right direction.
When I find the file can I just rem out the top level customErrors
section or is this going to cause an issue for other web applications on the same machine that don't have customErrors
defined?
That section should be modified on the root web.config
If you re receiving that error, maybe you have several web.config in sub-directories of your main application, you should start checking those to remove them
Clearly I have some config hierarchy at play here but I don't know which file I need to look at (I have 276 web.config files on my machine) - can someone point me in the right direction.
Why don't you simply use windows search to find documents containing the string customErrors
To enable Windows 7 advanced search:
Config files hierarchy
<windir>\Microsoft.NET\Framework\<ver>\Config\Machine.config
<windir>\Microsoft.NET\Framework\<ver>\Config\Web.config
<wwwroot>\Web.config
<wwwroot>|IIS Web Site path\<webapp>\Web.config
<wwwroot>|IIS Web Site path\<webapp>\<dir>\Web.config
User contributions licensed under CC BY-SA 3.0