Service has zero application (non-infrastructure) endpoints

user280626 picture user280626 · Feb 24, 2010 · Viewed 111.4k times · Source

I recently created a WCF service (dll) and a service host (exe). I know my WCF service is working correctly since I am able to successfully add the service to WcfTestClient.

However, I seem to be running into an issue when I comes to utlizing my WCF from a service host (exe). I can add a reference to the WCF (dll) to my service host (exe) and create the necessary componets to the exe; such as the service installer, service host, and the app.config, compile and then finally install the exe using InstallUtil. But, when I tried to start the service in the Microsoft Management Console, the service immediately stops after being started.

So I began investigating what could exactly be causing this issue an came up with this error from the Application Log in the Event Viewer.

Description:

Service cannot be started. System.InvalidOperationException: Service 'Service' 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.

This error is actually generated in the OnStart; of my exe, when I perform this call ServiceHost.Open(). I've seen numerous posts where other individuals have run into this issue, however most if not all of them, claim that the service name or contract; namespace and class name, are not being specified. I checked both of these entries in my config file; in the exe as well as in the dll, and they match up PERFECTLY. I've had other people in the office double check behind me to make sure I wasn't going blind at one point, but of course they came to the same conclusion as me that everything looked like it was specified correctly. I am truly at a lost as to what is going on at this point. Could anyone help me with this issue?

Another thing that came up as a possible reason this may be happening is that the app.config is never being read; at least not the one I think should be getting read. Could this be the issue? If so, how can I go about addressing this issue. Again, ANY help would be appreciated.

Answer

SteveCav picture SteveCav · Jul 22, 2010

I just had this problem and resolved it by adding the namespace to the service name, e.g.

 <service name="TechResponse">

became

 <service name="SvcClient.TechResponse">

I've also seen it resolved with a Web.config instead of an App.config.