@H_502_1@我有一个网站在另一个网站的子目录中运行.它们运行在单独的应用程序池中.这两个站点正在运行不同版本的Entity Framework.所以在web.config中的子目录我有:
<remove name="entityFramework"/> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,EntityFramework,Version=4.4.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" requirePermission="false" />
Section or group name 'entityFramework' is already defined. Updates to this may only occur at the configuration level where it is defined.
我也把< location>标签在父web.config中,尽可能:
<location path="." inheritInChildApplications="false">
<位置>标签存在于父web.config的< entityFramework>部分.
我已经在IIS的applicationHost.config文件(System32和SysWOW64中的这两个文件)中放置了enableConfigurationOverride =“false”.
如何防止子目录中的网站看到父实体框架标签?
编辑
IIS版本:7.5.7600.16385
从父web.config:
<configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,Version=6.0.0.0,PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections>
升
<location path="." inheritInChildApplications="false"> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory,EntityFramework"> <parameters> <parameter value="mssqllocaldb" /> </parameters> </defaultConnectionFactory> <providers> <provider invariantName="System.Data.sqlClient" type="System.Data.Entity.sqlServer.sqlProviderServices,EntityFramework.sqlServer" /> </providers> </entityFramework> </location>
从小孩web.config:
<configSections> <remove name="entityFramework"/> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection,Microsoft.Practices.EnterpriseLibrary.Common,Version=5.0.505.0,PublicKeyToken=31bf3856ad364e35" requirePermission="true" /> </configSections>
升
<entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.sqlConnectionFactory,EntityFramework" /> </entityFramework>
编辑2
关于使用< clear />:这会导致关于缺少节声明的一系列错误.如果我添加了〜100行的段声明,我得到错误:已检测到ASP.NET设置不适用于集成管理管道模式.即使我使用< validation validateIntegratedModeConfiguration =“false”/>在< system.webServer> ;.