Reputation: 24979
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>
Upvotes: 3
Views: 2225
Reputation: 28064
.NET framework version is defined at the application level. You can have a website (www.example.com) running as a .NET 2.0 application, and then set up a virtual directory (i.e. separate application underneath the main site) as a .NET 4.0 application. Application pools cannot share different .NET versions, so you'd need a separate app pool for each application, but this has nothing to do with site configuration.
Having said that, if you have a main site configured as a .NET 2.0 app and a virtual directory configured as a .NET 4.0 app, the .NET 4.0 app cannot inherit the config from the .NET 2.0 app. The config schema is not backward compatible.
Upvotes: 0
Reputation: 6111
You can't have .NET 4.0 running as a nested application inside a .NET 2.0 application.
Upvotes: 1