在 IIS/ASP.Net 的 .NET 1.1 应用程序中创建 .NET 3.0 子应用程序

发布于 2024-08-26 22:41:18 字数 732 浏览 5 评论 0 原文

我基本上想做与 相同的事情这个问题, 在文件夹中创建一个新应用程序,以便可以按如下方式访问它。

* http://www.domain.com/ < Main App
* http://www.domain.com/newapp < New App

问题是 newapp 正在从主应用程序读取 web.config,这会导致错误,因为它不具有所有相同的 dll 等。
对于新应用程序,在 IIS 中,起始点设置在 /newapp,所以我根本不知道为什么它要从 / 读取 web.config。它被设置为它自己的应用程序。

我正在 XP Pro 上的 IIS6 中对此进行测试,因此不确定这是否会产生影响。 主应用程序是 dotnet 1.1,新应用程序是 3.0。

编辑: 将 'inheritInChildApplications 添加到 >在 1.1 中不起作用,您会收到错误:

Parser Error Message: Unrecognized attribute 'inheritInChildApplications'

I am basically trying to do the same thing as this question,
create a new application within a folder so it could be accessed as follows.

* http://www.domain.com/ < Main App
* http://www.domain.com/newapp < New App

The problem is that newapp is reading the web.config from the Main App, which is causing errors because it doesn't have all the same dlls etc.
For New App, in IIS, the starting point is set at /newapp, so I am not sure why it is reading the web.config from / at all. It is set as it's own application.

I am testing this in IIS6 on XP Pro, so not sure if that makes a difference.
The Main App is dotnet 1.1, and New App is 3.0.

Edit:
Adding 'inheritInChildApplications to <location> doesn't work in 1.1, you get an error:

Parser Error Message: Unrecognized attribute 'inheritInChildApplications'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

荒岛晴空 2024-09-02 22:41:18

这是设计使然。 Web.config 是从根目录读取到相关应用程序文件夹的。根目录中的所有更改都会应用于您的应用程序,除非您的应用程序对其进行了更改。阅读此MSDN 链接以更好地了解 Web.config 层次结构&遗产。

为了让您的应用程序忽略根目录中的设置,您需要应用 location 元素,并将路径的继承InChildApplications 属性设置为 false。

例如:

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

例如,如果根 web.config 中有一个仅特定于根应用程序的部分,则将位置元素包裹在该部分周围。使用“.”路径指示您希望此应用程序文件夹下的路径中的所有项目不继承此部分。

This is by design. Web.config is read from the root to the app folder in question. All changes in the root apply through to your app unless your app changes it. Read this MSDN link to get a better understanding of Web.config hierarchy & inheritance.

In order to have your app ignore settings in the root you need to apply the location element with the inheritInChildApplications attribute set to false for the path.

Something like:

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

For example, if you have a section in the root web.config that is specific to the root app only, then wrap the location element around that section. Use the path of "." to indicate you want all items in the path below this app folder to NOT inherit this section.

不再让梦枯萎 2024-09-02 22:41:18

正如已经说过的——inheritInChildApplications 在.net 1.1 中不起作用。

我在这个领域做了很多研究,最初来到这里是为了寻找解决方案。题主没有说清楚这是1.1针对性的问题。

如果您遇到问题并且您的应用程序是 2.0 或更高版本,请查看本文以获取有关继承InChildApplications属性的大量详细信息:

As has been said - the inheritInChildApplications doesn't work in .net 1.1.

I have been doing a lot of research in this area and I originally landed here looking for solutions. The subject doesn't make it clear that this is a 1.1 targeted question.

If you are having problems and your apps are 2.0 or above then check out this article for a lot of detailed information information on the inheritInChildApplications attribute:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文