Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

InheritInChildApplications attribute not recognized in web.config location element

I've tried wrapping my

<system.web> 

with

<location path="." InheritInChildApplications="false"> 

like this

<location path="." InheritInChildApplications="false"> <system.web>...</system.web> </location> 

But VS 2010 Web Developer Express keeps saying

The 'InheritInChildApplications' attribute is not allowed

When I run my web app there's an error:

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

Config Error Unrecognized attribute 'InheritInChildApplications'.

My configuration: ASP.NET 4.0 RTM, VS 2010, IIS 7.5

like image 937
mare Avatar asked Apr 24 '10 19:04

mare


People also ask

What is location path in web config?

The <location> element typically contains a <system. web> element and other configuration elements exactly as you use them in the Web. config file. The path attribute of the <location> element specifies the virtual directory or the file name where the location configuration items apply.

How do I stop inheriting parent web config?

Ignoring the parent web config settings The Web. Config settings are inherited automatically from the root application, and it may raise a problem to run the Dashboard Service at IIS. To overcome this, use the location tag with path value as '. ' and inheritInChildApplications as 'false' in the Web.


2 Answers

It could be because you don't have a namespace specified on the root node? eg

You need

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> 

not

<configuration> 
like image 96
Sprintstar Avatar answered Sep 24 '22 13:09

Sprintstar


I think the issue here is that inheritInChildApplications is not a valid attribute of the location node in .net 4.0.

The reason the above fix works is because you are specifically targeting the .net 2.0 configuration schema

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> 

.net 4.0 privdes a different way of dealing with config inheritance.

See http://msdn.microsoft.com/en-us/library/b6x6shw7.aspx and http://msdn.microsoft.com/en-us/library/ms178692.aspx for more details.

like image 32
GavinR Avatar answered Sep 24 '22 13:09

GavinR