WCF library in Windows service common error

Service '<ServiceName>' 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.
at System.ServiceModel.Description.DispatcherBuilder.EnsureThereAreNonMexEndpoints(ServiceDescription description)
at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
at System.ServiceModel.ServiceHostBase.InitializeRuntime()
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at <ServiceName>.Service1.OnStart(String[] args) in

This problem is for when you have a WCF library and your integrating it into a Windows service.

Ok check the following. When you added your app.config file from the WCF library into your windows service did you alter the name?

What I mean is:

<Service name=”Namespace” + “Type” ....

When you copied it over it had the old namespace and type from the WCF library. In your windows service alter the app.config to match your service as per example below.

namespace TestServiceNamespace

{

 class TestTypeService: ServiceBase

{

}

}

The service name would be testNamespace in the windows servioce

<Service name=” TestServiceNamespace.TestTypeService” ....

Hopefully this saves you a piece of time..