When trying to create the service host instance of the WCF service like:
ServiceHost svcHost = new ServiceHost(typeof(MyService));
you might get following exception:
Service 'UnitTests.SbbNetCoreTest+TestServiceCallback' 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.
I’m not going to explain basic reasons for this exception. Instead I will shortly explain some issue with the name of the service, which is not that obvious as it looks like.
In 99,99% cases the problem is in the name of the service in the config file. For example following configuration would cause this exception:
However, your service might be implemented as a nested class of some other class. For example
public class MyParentClass
public class MyService() : IMyService
If so, you will need to specify following configuration name:
Nov 19 2010, 01:28 PM