views:

139

answers:

2

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'
+4  A: 

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.

klabranche
I added this around <system.web> at the root but since that is a 1.1 application it does not recognize it: I get this error when trying to view the page at the root: Parser Error Message: Unrecognized attribute 'inheritInChildApplications'
Karen
Oh. That would be a problem. This element is for 2.0 and higher. Unless you can get the 1.1 to 2.0 you might be a little stuck since this is by design for how the web.config works.
klabranche
The only thing I found was adding remove tags to the child web.config for each item that is causing issues. ex: <remove name="RewriteModule"/>. However this makes the child app web.config dependent on the parent so probably not the best option.
Karen
That is about your only option if you can't change how the applications sit in relation to each other and/or upgrade the 1.1 app. It may be a hack but it's a good one for your situation. Kudos on that. I didn't even think about that myself. :-)
klabranche
another alternative is to throw the assemblies into the sub apps bin folder but this is just as messy
rtpHarry
@rtpHarry - True and VERRRRYYY True.
klabranche
@klabranche: I needed the exact same thing today (except everything is 3.5, so no problems there). This works perfectly, thanks.
Joe Enos
@Joe-Enos That's great to hear!!!! Glad to help.
klabranche
A: 

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:

rtpHarry
Sorry - I added more detail to the subject to make it more clear. At time of original posting, I didn't realize it was a 1.1 issue.
Karen