简体   繁体   中英

.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.

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.

Whenever I try to access 'MyTestApp' though I get an error...

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. 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?

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?

I think you need to configure your virtual directory for your 1.1 app as a "application" directory.

I am on IIS7, so I am providing this from memory!

If you right click it in IIS, and then click " Create Application " that should do the trick.

Web.config is always read based on proximity (closest to application first, up through folder structure, right up to Machine.config ).

Hope this helps.

Edit

Checkout the guide on MSDN on creating Virtual Directories. It also touches on creating Applications.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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