For example
// Create a ServiceHost for the Service type and
// provide the base address.
mServiceHost = new ServiceHost(typeof(T));
// Open the ServiceHostBase to create listeners and start
// listening for messages.
mServiceHost.Open();
where in this case T is TransactionProcessingService.
So far I am getting an error with the app config and not sure how I should modify it:
Service 'TransactionProcessingWindowsService.TransactionProcessingService`1[[Common.TransactionProcessing, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.
Here's how I tried to set up my config
<service name="TransactionProcessingWindowsService.TransactionProcessingService<TransactionProcessingWindowsService.TransactionProcessing>"
behaviorConfiguration="TransactionProcessingServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/TransactionProcessingService/service"/>
</baseAddresses>
</host>
<endpoint address=""
binding="wsHttpBinding"
contract="TransactionProcessingWindowsService.ITransactionProcessingService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
Thanks
Exception details show you what service name should be used. Try this:
<service name="TransactionProcessingWindowsService.TransactionProcessingService`1[[Common.TransactionProcessing, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]"
behaviorConfiguration="TransactionProcessingServiceBehavior">
but that is not cool, as you need to update config file each time you changing the assembly version or sign it.