在web.config位置元素中无法识别InheritInChildApplications属性

时间:2010-04-24 19:36:37

标签: asp.net asp.net-mvc web-config

我尝试过包装

<system.web>

<location path="." InheritInChildApplications="false">
像这样

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

但VS 2010 Web Developer Express一直在说

  

不允许使用“InheritInChildApplications”属性

当我运行我的网络应用程序时出现错误:

  

HTTP错误500.19 - 内部服务器错误
  无法访问请求的页面,因为页面的相关配置数据无效。

     

配置错误无法识别的属性'InheritInChildApplications'。

我的配置:ASP.NET 4.0 RTM,VS 2010,IIS 7.5

4 个答案:

答案 0 :(得分:62)

可能是因为您没有在根节点上指定名称空间?例如

你需要

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

不是

<configuration>

答案 1 :(得分:15)

我认为这里的问题是inheritInChildApplications不是.net 4.0中位置节点的有效属性。

上述修复工作原因是因为您专门针对.net 2.0配置架构

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

.net 4.0提供了一种处理配置继承的不同方式。

有关详细信息,请参阅http://msdn.microsoft.com/en-us/library/b6x6shw7.aspxhttp://msdn.microsoft.com/en-us/library/ms178692.aspx

答案 2 :(得分:9)

它不应该是小写的“我”吗?

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

我在过去的4或5个项目中成功使用它。我的规格与你的相似。我还在使用.NET 4 RC。我还在位置中包含了system.webServer设置。

祝你好运,

答案 3 :(得分:1)

我经常使用clear来达到这个目的:

<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>

相关问题