InheritInChildApplications attribute not recognized in web.config location element

22,761

Solution 1

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

Solution 2

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>

Solution 3

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.

Solution 4

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>

Share:
22,761

Related videos on Youtube

mare
Author by

mare

Software project manager and fullstack developer at Centiva, Slovenia. Focusing on web and mobile development using open web technologies like HTML5, JavaScript/TypeScript, Svelte/Angular, REST services, document and relational databases, cloud and containers.

Updated on July 09, 2022

Comments

  • mare
    mare almost 2 years

    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

    • ak3nat0n
      ak3nat0n over 13 years
      Did you ever get this to work? I am having the same issue ...
    • mare
      mare over 13 years
      nope, I solved my issues in root app but the application in a sub folder never worked.
  • mare
    mare about 14 years
    Aaarrrgh! LOL! It's capitalized in MSDN manuals, so I used it as such.
  • mare
    mare about 14 years
    Ok, the root website is working now, but the subdirectory (configured as an aplication) still tries to load the contents of my 'namespaces' element.
  • kim3er
    kim3er about 14 years
    That sucks. Let me know if it works. It's worth flagging it on MSDN.
  • kim3er
    kim3er about 14 years
    Have you changed the default application name of the sub app?
  • BrunoLM
    BrunoLM about 13 years
    There is one problem with it... The web transforms doesn't work with the correct namespace...
  • Mark
    Mark over 12 years
    Thanks - that also cleaned up a couple of other warning that have been bugging me :)
  • dotjoe
    dotjoe about 12 years
    seems .net 4 brought the attribute back?
  • bradjive
    bradjive over 11 years
    This worked for me. Should probably mark this is as the correct answer based on votes.
  • user1069816
    user1069816 over 11 years
    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
  • Sparkle
    Sparkle over 11 years
    Just set it above the nodes you wish to clear. <namespaces> <clear /> or <providers> <clear /> or <appSettings> <clear /> etc etc etc
  • Sparkle
    Sparkle over 11 years
    I don't like turning off the inheritance altogether so I prefer to use clear where I need to.
  • shashwat
    shashwat almost 11 years
    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.
  • napster
    napster almost 11 years
    I don't think it has to refer to an actual file, it just has to match what VS is expecting.
  • David Ewen
    David Ewen about 9 years
    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 <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transfo‌​rm">
  • Si8
    Si8 about 7 years
    Can I put that around the entire Web.config or just system.web?