27

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

Community
  • 1
  • 1
mare
  • 13,033
  • 24
  • 102
  • 191

4 Answers4

63

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>
Sprintstar
  • 7,938
  • 5
  • 38
  • 51
  • 3
    There is one problem with it... The web transforms doesn't work with the correct namespace... – BrunoLM Mar 29 '11 at 00:19
  • Thanks - that also cleaned up a couple of other warning that have been bugging me :) – Mark Nov 01 '11 at 05:03
  • This worked for me. Should probably mark this is as the correct answer based on votes. – bradjive Sep 07 '12 at 15:05
  • it seems that this schema has problem in loading. When accessing this url directly in browser it is giving error. I think it should an xml file. – shashwat Jul 03 '13 at 06:02
  • I don't think it has to refer to an actual file, it just has to match what VS is expecting. – Sprintstar Jul 10 '13 at 11:52
  • If you want to get web transforms working again you also need to define the xmlns in the transform against the configuration node like this `` – David Ewen Mar 04 '15 at 04:46
16

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.

GavinR
  • 192
  • 2
  • 10
9

Shouldn't it be a lowercase 'i'?

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

I have been using it successfully on the last 4 or 5 projects I have worked on. My spec is similar to yours. I'm still using .NET 4 RC. I also include the system.webServer settings within location.

Good luck,

Rich

kim3er
  • 6,306
  • 4
  • 41
  • 69
1

I use clear quite often to achieve this:

<configuration>
   <system.web>
  <assemblies>
     <clear>
  <clientTarget>
     <clear>
  <compilation>
     <compilers>
        <clear>
  <httpHandlers>
     <clear>
  <httpModules>
     <clear>
  <serviceDescriptionFormatExtensionTypes>
     <clear>
  <webServices>
     <protocols>
        <clear>
  <soapExtensionTypes>
     <clear>
  <soapExtensionReflectorTypes>
     <clear>
  <soapExtensionImporterTypes>
     <clear>

Sparkle
  • 2,459
  • 3
  • 18
  • 20
  • I tried this and got the error: HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. The configuration section 'clear' cannot be read because it is missing a section declaration – user1069816 Nov 21 '12 at 09:22
  • Just set it above the nodes you wish to clear. or or etc etc etc – Sparkle Nov 21 '12 at 10:40
  • I don't like turning off the inheritance altogether so I prefer to use clear where I need to. – Sparkle Nov 21 '12 at 10:45