Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't stop web.config inheritance

I created an application inside a website in IIS.

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)

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).

i tried wrapping my system.web as well as system.serviceModel in the following directive:

  <location path="." inheritInChildApplications="false">
    <system.web>
    ...
  </location>

but the handlers and modules continue to try to load.

next, i tried clearing out modules and handlers.

<httpModules>
  <clear />
</httpModules>
<httpHandlers>
  <clear />
</httpHandlers>

this resulted in following error:

No http handler was found for request type 'GET'

next i tried to manually add only the necessary handler for the .svc

     <add 
       verb="*"
       path="*.svc"
       type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

this resulted in:

Could not load type 'System.ServiceModel.Activation.HttpHandler' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

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).

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.

my 4.0 application is running under separate application pool.

adding entire web.config

<?xml version="1.0"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.web>
      <compilation debug="true" />
      <authentication mode="Windows" />
      <httpModules>
        <clear />
      </httpModules>
      <httpHandlers>
        <clear />
        <add verb="*" path="*.svc"
          type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </httpHandlers>
    </system.web>
    <system.serviceModel>
      <bindings>
        <!--<basicHttpBinding>
        <binding name="extAcctCustMapBinding" maxBufferSize="1000000"
          maxReceivedMessageSize="1000000" />
      </basicHttpBinding>-->
      </bindings>

      <behaviors>
        <serviceBehaviors>
          <behavior name="DebugBehavior">
            <serviceMetadata httpGetEnabled="true" />
            <serviceDebug includeExceptionDetailInFaults="true" />
          </behavior>
        </serviceBehaviors>
      </behaviors>

      <services>
        <service behaviorConfiguration="DebugBehavior" name="MyService">
          <endpoint binding="basicHttpBinding" name="MyService"
            contract="IMyService" />
        </service>
      </services>

      <serviceHostingEnvironment multipleSiteBindingsEnabled="false" />
    </system.serviceModel>

    <system.webServer>
      <modules runAllManagedModulesForAllRequests="false"/>
    </system.webServer>
  </location>
</configuration>
like image 719
Sonic Soul Avatar asked May 29 '26 01:05

Sonic Soul


1 Answers

You can't have .NET 4.0 running as a nested application inside a .NET 2.0 application.

like image 161
Frazell Thomas Avatar answered Jun 01 '26 04:06

Frazell Thomas