We have deployed an ASP.NET Website (App 1) in IIS 7.5. Then under that application create another ASP.NET application (App 2). But in App 2, I don't want to inherit the web.config
from App 1.
我们在IIS 7.5中部署了一个ASP.NET网站(App 1)。然后在该应用程序下创建另一个ASP.NET应用程序(App 2)。但是在App 2中,我不想从App 1继承web.config。
If I try to do the following in App 1's, web.config
:
如果我尝试在App 1中执行以下操作,web.config:
<location path="." inheritInChildApplications="false">
<configSections>
<!-- etc -->
</configSections>
</location>
it reports the error:
它报告错误:
Config Error The configuration section 'configSections' cannot be read because it is missing a section declaration
配置错误配置部分'configSections'无法读取,因为它缺少部分声明
If I try to do:
如果我尝试做:
<remove name = "system.web.extensions" />
it still reports the same error:
它仍然报告相同的错误:
4 个解决方案
#1
7
If you can deploy your child application to a separate website (same machine, different port), Application Request Routing may be able to help with this.
如果您可以将子应用程序部署到单独的网站(相同的计算机,不同的端口),则应用程序请求路由可能可以帮助解决此问题。
The solution is similar to this post. First, install ARR. Then, configure your "child" application on a website that listens on a non-standard port. Next, configure a rewrite rule on the "parent" application's web site that matches the original path to the "child" application. Have this rule forward the request to the newly created website listening on the new port.
解决方案类似于这篇文章。首先,安装ARR。然后,在侦听非标准端口的网站上配置“子”应用程序。接下来,在“父”应用程序的网站上配置与“子”应用程序的原始路径匹配的重写规则。有这个规则将请求转发到新创建的网站上侦听新端口。
I would post an example, but I expect it is fairly straightforward to see how this would work by looking at the post referenced above.
我会发布一个例子,但我希望通过查看上面引用的帖子来看看它是如何工作的相当简单。
#2
4
This worked for me.
这对我有用。
For those who could not get the location path solution working you might have forgotten to close the location elements tag (if you just edited the web.config in a text editor on the server). Here is an example:
对于那些无法使位置路径解决方案工作的人,您可能忘记关闭位置元素标记(如果您刚刚在服务器上的文本编辑器中编辑了web.config)。这是一个例子:
<configuration>
<configSections>
...
</configSections>
<connectionStrings>
...
</connectionStrings>
<location path="." inheritInChildApplications="false">
<system.web>
...
</system.web>
...
</location>
</configuration>
Notice that configSections and connectionStrings should not be in the location element which is probably the reason the OPs attempt did not work.
请注意,configSections和connectionStrings不应该在location元素中,这可能是OP尝试不起作用的原因。
#3
0
Have you tried the following link:
您是否尝试过以下链接:
http://www.kowitz.net/archive/2007/05/16/stopping-asp-net-web-config-inheritance
http://www.kowitz.net/archive/2007/05/16/stopping-asp-net-web-config-inheritance
I can vouch for this as working as I have done this in the past.
我可以保证这一点像我过去那样工作。
#4
0
You can't wrap the whole <configSections>
configuration element in a <location path="." inheritInChildApplications="false">
. This isn't supported in ASP.NET (yet).
您无法将整个
From the documentation:
从文档:
SectionInformation.InheritInChildApplications Property
SectionInformation.InheritInChildApplications属性
The InheritInChildApplications property applies only to location-specific configuration settings.
InheritInChildApplications属性仅适用于特定于位置的配置设置。
Also:
也:
Gets or sets a value that indicates whether the settings that are specified in the associated configuration section are inherited by applications that reside in a subdirectory of the relevant application.
获取或设置一个值,该值指示关联配置部分中指定的设置是否由驻留在相关应用程序的子目录中的应用程序继承。
<configSection>
elements are special and are not configuration settings as such. They are used to define the handlers for configuration settings.
If you need to remove a conflicting configuration <section>
from a child application you can do this in the child application's web.config
file with the <remove>
element:
如果需要从子应用程序中删除冲突的配置
remove
Element forconfigSections
(General Settings Schema)删除configSections的元素(常规设置架构)
#1
7
If you can deploy your child application to a separate website (same machine, different port), Application Request Routing may be able to help with this.
如果您可以将子应用程序部署到单独的网站(相同的计算机,不同的端口),则应用程序请求路由可能可以帮助解决此问题。
The solution is similar to this post. First, install ARR. Then, configure your "child" application on a website that listens on a non-standard port. Next, configure a rewrite rule on the "parent" application's web site that matches the original path to the "child" application. Have this rule forward the request to the newly created website listening on the new port.
解决方案类似于这篇文章。首先,安装ARR。然后,在侦听非标准端口的网站上配置“子”应用程序。接下来,在“父”应用程序的网站上配置与“子”应用程序的原始路径匹配的重写规则。有这个规则将请求转发到新创建的网站上侦听新端口。
I would post an example, but I expect it is fairly straightforward to see how this would work by looking at the post referenced above.
我会发布一个例子,但我希望通过查看上面引用的帖子来看看它是如何工作的相当简单。
#2
4
This worked for me.
这对我有用。
For those who could not get the location path solution working you might have forgotten to close the location elements tag (if you just edited the web.config in a text editor on the server). Here is an example:
对于那些无法使位置路径解决方案工作的人,您可能忘记关闭位置元素标记(如果您刚刚在服务器上的文本编辑器中编辑了web.config)。这是一个例子:
<configuration>
<configSections>
...
</configSections>
<connectionStrings>
...
</connectionStrings>
<location path="." inheritInChildApplications="false">
<system.web>
...
</system.web>
...
</location>
</configuration>
Notice that configSections and connectionStrings should not be in the location element which is probably the reason the OPs attempt did not work.
请注意,configSections和connectionStrings不应该在location元素中,这可能是OP尝试不起作用的原因。
#3
0
Have you tried the following link:
您是否尝试过以下链接:
http://www.kowitz.net/archive/2007/05/16/stopping-asp-net-web-config-inheritance
http://www.kowitz.net/archive/2007/05/16/stopping-asp-net-web-config-inheritance
I can vouch for this as working as I have done this in the past.
我可以保证这一点像我过去那样工作。
#4
0
You can't wrap the whole <configSections>
configuration element in a <location path="." inheritInChildApplications="false">
. This isn't supported in ASP.NET (yet).
您无法将整个
From the documentation:
从文档:
SectionInformation.InheritInChildApplications Property
SectionInformation.InheritInChildApplications属性
The InheritInChildApplications property applies only to location-specific configuration settings.
InheritInChildApplications属性仅适用于特定于位置的配置设置。
Also:
也:
Gets or sets a value that indicates whether the settings that are specified in the associated configuration section are inherited by applications that reside in a subdirectory of the relevant application.
获取或设置一个值,该值指示关联配置部分中指定的设置是否由驻留在相关应用程序的子目录中的应用程序继承。
<configSection>
elements are special and are not configuration settings as such. They are used to define the handlers for configuration settings.
If you need to remove a conflicting configuration <section>
from a child application you can do this in the child application's web.config
file with the <remove>
element:
如果需要从子应用程序中删除冲突的配置
remove
Element forconfigSections
(General Settings Schema)删除configSections的元素(常规设置架构)