问题描述
我目前在IIS7 2×ASP.NET 3.5 Web应用程序(可以叫他们WebParent和WebChild)。
I currently have 2 x ASP.NET 3.5 web applications in IIS7 (lets call them WebParent and WebChild).
WebChild嵌套在IIS7的WebParent上市内,并设置为(内WebParent,而不仅仅是一个虚拟目录)的应用程序。目前,双方使用自己(经典)应用程序池。
WebChild is nested within the WebParent listing in IIS7 and is set up as an application (rather than just a virtual directory within WebParent). Both currently use their own (Classic) application pool.
这两个WebParent和WebChild有自己的根目录下自己完全定义的web.config文件。
Both WebParent and WebChild have their own fully defined web.config files in their own root directories.
我原以为看到,因为WebChild被定义为在IIS中的应用程序,它不会继承WebParent配置文件的任何内容。然而,尽管这种配置中,我看到了有关已经被定义(这是正确的,也有在这两个配置文件几个项目在web.config中各种元素的错误,但我认为他们应该完全独立从一个处理另一个)?
I had assumed that seeing as WebChild is defined as an 'Application' within IIS, that it would not inherit anything from the WebParent configuration file. However, despite this configuration, I am seeing errors related to various elements within the web.config already being defined (which is correct, there are a couple items that are in both config files, but I thought they should be treated completely independently from one another)?
任何人都可以请说明为什么这可能发生?
Can anyone please clarify why this might be occurring?
推荐答案
如果他们是重复的,你必须<删除/>
然后在子应用程序的web.config,然后再重新添加元素你会喜欢它,它的地方。这是假设你想有一个不同的值。如果不这样做,那么就忽略的元素。连接字符串将是什么一个很好的例子是为所有应用程序可能共同点 - 。所以你只需要在根将其指定
If they are repeated, you'll have to <remove/>
then in the child application web.config first, then add back the element you'd like it it's place. This is assuming that you'd like to have a different value. If you don't, then just omit the element. A connection string would be a good example of something that is likely common for all applications - so you only need to specify it in the root.
例如:
<siteMap defaultProvider="AdminSiteMapProvider" enabled="true">
<providers>
<remove name="AdminSiteMapProvider"/>
<add name="AdminSiteMapProvider" description="Admin SiteMap provider" type="System.Web.XmlSiteMapProvider" siteMapFile="~/App_Data/admin.sitemap" securityTrimmingEnabled="true" />
</providers>
</siteMap>
这篇关于嵌套ASP.NET“应用程序”中的IIS继承父配置值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!