简体   繁体   English

.Net 1.1 Web应用程序正在从根文件夹中拾取web.config

[英].Net 1.1 Web application is picking up web.config from root folder

I have a .Net 1.1 web application sitting in a folder called C:\\inetpub\\wwwroot\\MyTestApp, where 'MyTestApp' is a virtual directory and is configured to be on ASP.Net version 1.1.4322 in IIS 5.1. 我在一个名为C:\\ inetpub \\ wwwroot \\ MyTestApp的文件夹中有一个.Net 1.1 Web应用程序,其中“ MyTestApp”是虚拟目录,并配置为位于IIS 5.1中的ASP.Net 1.1.4322版上。

In the root directory (C:\\inetpub\\wwwroot) there is a web.config file for a .Net2.0 application, because the root folder contains some web pages written in .Net2.0. 在根目录(C:\\ inetpub \\ wwwroot)中,有一个用于.Net2.0应用程序的web.config文件,因为该根文件夹包含一些用.Net2.0编写的网页。

Whenever I try to access 'MyTestApp' though I get an error... 每当我尝试访问“ MyTestApp”时,尽管出现错误...

Parser Error Message: Unrecognized configuration section 'connectionStrings'

Source File: c:\inetpub\wwwroot\web.config    Line: 17 

The .Net1.1 application in the MyTestApp folder is trying to access the web.config file in the root folder, and getting upset because it is on a different version. MyTestApp文件夹中的.Net1.1应用程序正在尝试访问根文件夹中的web.config文件,并因为它处于其他版本而感到不高兴。 How can I tell the MyTestApp folder NOT to use the web.config file in the root folder, but instead just use the web.config in its own folder? 如何告诉MyTestApp文件夹不要在根文件夹中使用web.config文件,而要在自己的文件夹中使用web.config?

Is such a thing possible, or is nesting a .Net 1.1 application in a sub-folder under a .Net 2.0 application a no-no? 这是可能的,还是将.Net 1.1应用程序嵌套在.Net 2.0应用程序下的子文件夹中?

I think you need to configure your virtual directory for your 1.1 app as a "application" directory. 我认为您需要将1.1应用程序的虚拟目录配置为“应用程序”目录。

I am on IIS7, so I am providing this from memory! 我在IIS7上,所以我是从内存中提供的!

If you right click it in IIS, and then click " Create Application " that should do the trick. 如果在IIS中右键单击它,然后单击“ 创建应用程序 ”即可解决问题。

Web.config is always read based on proximity (closest to application first, up through folder structure, right up to Machine.config ). Web.config始终基于接近度进行读取(最接近应用程序,首先通过文件夹结构,直到Machine.config )。

Hope this helps. 希望这可以帮助。

Edit 编辑

Checkout the guide on MSDN on creating Virtual Directories. 在MSDN上查阅有关创建虚拟目录的指南。 It also touches on creating Applications. 它还涉及创建应用程序。

您要在根web.config中使用InheritInChildApplications设置,并将其设置为false。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM