views:

86

answers:

1

I have a virtual directory setup in one of my web apps that needs to not inherit the web.config of the main app so it can run on it's own. I am wondering how I can do this because right now when I hit it (mainwebapp.domain.com/virdir) it throws an error saying it can't find some dependencies that are listed in the main apps web.config (shows main app web.config in the error message), this virdir contains it's own little app that needs to just run standalone.

Here is the problem area:

Line 143:      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
Line 144:      <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 145:      <add verb="*" path="weborb.aspx" type="Weborb.ORBHttpHandler" />
Line 146:      <add verb="*" path="codegen.aspx" type="Weborb.Management.CodeGen.CodegeneratorHttpHandler" />
Line 147:     <!--elm <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" /> elm-->

error is on line 145: "Could not load type 'Weborb.ORBHttpHandler'." (this is the parent web.config that it is showing the error in, which I do not want to modify)...

If I add <clear/> to the top of that same block in the child web.config then I get:

"No http handler was found for request type 'GET'"

+1  A: 

In your case you want to use remove (put it first)

  <remove verb="POST,GET,HEAD" path="elmah.axd" />

Other Options:

If you can change your main app do the below.

 <location path="." inheritInChildApplications="false">
     <!-- settings --> 
  </location>

If you want to override what was inheritted, commonly you can use (example is a blurb from child web.config

<compilation debug="true">
        <assemblies>
            <clear/>
            <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        </assemblies>
    </compilation>

MSDN Guide on Web.Config inheritence.

Nix
I don't want ALL the sub apps to not inherit though, just this one... does that make sense?
shogun
You are basically saying, i want everyone to inherit, except this directory? can you update the above and show the problem section ?
Nix
You are going to end up just using clear, for the sections you want to overrride. I updated with an example above.
Nix
I added <clear/> to the child directory web.config as you specified but this changed nothing.
shogun
Can you post a sub section that shows the problem area?
Nix
done, see expanded question details
shogun
See my above post, i was assuming you were trying to get rid of path="elmah.axd", if you want to remove something else put it there.
Nix