title: can't stop web.config inheritance
body: <p>I created an application inside a website in IIS. </p>
  
  <p>my application is there to host a WCF service endpoint running .Net 4.0 code (the website it is created in, is running .Net 2.0)</p>
  
  <p>when i load this service endpoint, i get an error that models and handlers are missing (because root website has them defined in web.config). </p>
  
  <p>i tried wrapping my <strong>system.web</strong> as well as <strong>system.serviceModel</strong> in the following directive:</p>
  
  <pre><code>  &lt;location path="." inheritInChildApplications="false"&gt;
      &lt;system.web&gt;
      ...
    &lt;/location&gt;
  </code></pre>
  
  <p>but the handlers and modules continue to try to load. </p>
  
  <p>next, i tried clearing out modules and handlers. </p>
  
  <pre><code>&lt;httpModules&gt;
    &lt;clear /&gt;
  &lt;/httpModules&gt;
  &lt;httpHandlers&gt;
    &lt;clear /&gt;
  &lt;/httpHandlers&gt;
  </code></pre>
  
  <p>this resulted in following error: </p>
  
  <blockquote>
    <p>No http handler was found for request type 'GET'</p>
  </blockquote>
  
  <p>next i tried to manually add only the necessary handler for the .svc</p>
  
  <pre><code>     &lt;add 
         verb="*"
         path="*.svc"
         type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
  </code></pre>
  
  <p>this resulted in:</p>
  
  <blockquote>
    <p>Could not load type 'System.ServiceModel.Activation.HttpHandler' from
    assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089'.</p>
  </blockquote>
  
  <p>in IIS, my application is set to .Net 4.0. I did not see a way to specify the framework on application pool directly (it only has Recycling,Performance,Health,Identity tabs). </p>
  
  <p>all i need to do, is add this virtual dir/application running .net 4.0 inside a 2.0 website, and host a WCF endpoint. </p>
  
  <p><em><strong></em> my 4.0 application is running under separate application pool.</strong> </p>
  
  <p>adding entire web.config</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;location path="." inheritInChildApplications="false"&gt;
      &lt;system.web&gt;
        &lt;compilation debug="true" /&gt;
        &lt;authentication mode="Windows" /&gt;
        &lt;httpModules&gt;
          &lt;clear /&gt;
        &lt;/httpModules&gt;
        &lt;httpHandlers&gt;
          &lt;clear /&gt;
          &lt;add verb="*" path="*.svc"
            type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
        &lt;/httpHandlers&gt;
      &lt;/system.web&gt;
      &lt;system.serviceModel&gt;
        &lt;bindings&gt;
          &lt;!--&lt;basicHttpBinding&gt;
          &lt;binding name="extAcctCustMapBinding" maxBufferSize="1000000"
            maxReceivedMessageSize="1000000" /&gt;
        &lt;/basicHttpBinding&gt;--&gt;
        &lt;/bindings&gt;
  
        &lt;behaviors&gt;
          &lt;serviceBehaviors&gt;
            &lt;behavior name="DebugBehavior"&gt;
              &lt;serviceMetadata httpGetEnabled="true" /&gt;
              &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;
            &lt;/behavior&gt;
          &lt;/serviceBehaviors&gt;
        &lt;/behaviors&gt;
  
        &lt;services&gt;
          &lt;service behaviorConfiguration="DebugBehavior" name="MyService"&gt;
            &lt;endpoint binding="basicHttpBinding" name="MyService"
              contract="IMyService" /&gt;
          &lt;/service&gt;
        &lt;/services&gt;
  
        &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="false" /&gt;
      &lt;/system.serviceModel&gt;
  
      &lt;system.webServer&gt;
        &lt;modules runAllManagedModulesForAllRequests="false"/&gt;
      &lt;/system.webServer&gt;
    &lt;/location&gt;
  &lt;/configuration&gt;
  </code></pre>