开发者

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 'InheritInChildApplicatio开发者_如何学Gons'.

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


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>


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.


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


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>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜