开发者

How do I set a single virtual directory of my web app to not inherit web.config?

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 ca开发者_C百科n'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'"


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜