Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating .NET 3.0 sub-applications within .NET 1.1 applications in IIS/ASP.Net

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'
like image 470
Karen Avatar asked Oct 15 '22 07:10

Karen


1 Answers

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.

like image 95
Kevin LaBranche Avatar answered Nov 15 '22 09:11

Kevin LaBranche