This is documentation for Apprenda 7 and 8.
Documentation for newer version is available at https://new.docs.apprenda.com.

Custom Service Host Implementations

Under normal circumstances, Apprenda hosts your application's WCF services inside a System.ServiceModel.WebServiceHost object.  However, Apprenda also allows you to use a custom service host implementation, so long as it is contained inside the same assembly as your service and inherits from System.ServiceModel.ServiceHost.

Using a Custom Service Host

There are two ways to use a custom service host for your WCF services.  The first way is to simply let Apprenda auto-detect your service host.  This is obviously the easier way, but there are some caveats.  The second way is to specify the name of the service host to use in your application's Deployment Manifest.  Both approaches are outlined below.

Auto-Detection of Custom Service Hosts

In order for Apprenda to automatically detect and use a custom service host, the assembly that contains your application's WCF service(s) must contain one and only one class that inherits from System.ServiceModel.ServiceHost.  In this scenario, Apprenda detects this one and only class and configures your WCF services to use your service host implementation each time an instance of it is deployed.  If your assembly contains multiple service host implementations, Apprenda will show a warning when you promote your app and use the default service host.

Manually Configuring Custom Service Hosts

In addition to auto-detecting custom service hosts, Apprenda also allows you to specify the service host type to use for each WCF service in your application's Deployment Manifest.  Simply set the 'customServiceHostFullName' attribute equal to the full name (full namespace plus class name) of the service host type you wish to use for that service.  Just like with auto-detection, the custom service host implementation must reside in the same assembly as the service itself.

Manually specifying the custom service host to use allows you to have multiple service host implementations in the same assembly without trouble.  However, if a custom service host is specified in the Deployment Manifest but a corresponding service host class is not found in your assembly, then there will be an error when promoting your application.

 
<services>
    <service name="TimeCard.Service" customServiceHostFullName="TimeCard.Service.TimeCardServiceHost" />
</services>