WCF errors: WCF service has zero application (non-infrastructure) endpoints.This might be because no configuration file was found on your application, or because no service element matching the service name is found in the configuration file, or because no endpoints were defined in the service element.

By | January 20, 2010

This WCF error always pops on my computer when ever i’m creating brand new WCF service.  Bluntly, we can understand from error that we haven’t configured the service properly. Of course, there can be multiple causes. Handy tool which can help during this crisis 🙂 is “WCF Service Configuration Editor”. You can open WCF Service Configuration Editor (SvcConfigEditor.exe) by right clicking on configuration file in your WCF service library project or accessing it under Tools menu in the Visual Studio IDE.

On left pane in editor, you’ll see various service elements already defined.  Click on your Service Endpoint node.  90% of time root cause of this error will be hanging around this Service Endpoint definition. 

Remember, all the WCF service  configuration definition is found under  element

Here’s the checklist that should help resolve this error.

  • Confirm your Contract attribute of Endpoint element is pointing to appropriate Service contract instead of “IService1” unless you are still using “IService1” as service contract.  
  • Confirm your Name attribute of Service Element is set appropriately to Service class implementation instead of “Service1” unless you’re still using “Service1” as service implementation.
  • Also, Examine ServiceHost directive declaration in service1.svc markup.  Clean up any scrap you see and provide fully qualified namespace for the service class for service attribute.

 I strongly recommend you use Service Configuration Editor for any kind of poking around web.config/app.config related to WCF service. This way, you’ll keep service configuration neat and clean. especially with complex configuration files, this tool will come handy in organizing the service elements easily.