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

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

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: ,
developers.de is a .Net Community Blog powered by daenet GmbH.