developers.de
daenet's .NET Community

WCF 4.0 file-less activation error: ServiceHost only supports class service types.

Damir Dobric Posts

 

Damir@Phone    



My upcoming sessions:

AppFabric Applications at
NRW Conf 2011
09.Sept.2011 Wuppertal

HTML5 widgets in WP7+
Monodroid
Mobility Day
21.Sept.2011 - Zagreb

AppFabric and WCF sessions at
Advanced Developer Conference
26.-27. Oktober 2011 in Frankenthal

AppFabric Applications, queues, topics and more at
Prio Conference
02. - 03. November 2011 in Meistersingerhalle Nürnberg

AppFabric Applications deep dive hosted by
.NET User Group Frankfurt
17.Nov.2011 18.30-22.30 Microsoft - Bad Homburg 

 

 

When working with WCF 4.0 and File-Less Service Activation you may get following error:

ServiceHost only supports class service types.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: ServiceHost only supports class service types.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

 

This scaring and possibly nothing saying error has very simple solution. I have following service:

public class MyService : IMyService


I used following configuration, which tryies to activate the service contract.

<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
      <serviceActivations>
        <add relativeAddress="VirtualSvc.svc"
            
service="Daenet.NetFx40.RoutingHost.IMyService" />
      </serviceActivations>
</serviceHostingEnvironment>

 

File Less service activation however requires the service class name and NOT the contract name. Here is the solution:

<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
      <serviceActivations>
        <add relativeAddress="VirtualSvc.svc"
            
service="Daenet.NetFx40.RoutingHost.MyService" />
      </serviceActivations>
</serviceHostingEnvironment>


Posted Feb 25 2010, 11:12 PM by Damir Dobric
Filed under: ,

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
daenet GmbH