Tim C
Tim C

Reputation: 70598

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

Upvotes: 2

Views: 3114

Answers (2)

Dave Anderson
Dave Anderson

Reputation: 12274

You want to use the InheritInChildApplications setting in the root web.config and set this to false.

Upvotes: 0

Rob Cooper
Rob Cooper

Reputation: 28867

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.

Upvotes: 1

Related Questions