During one my application's development I was not able to call/access my WCF service (which was hosted in IIS), I was getting below error:
System.ServiceModel.ServiceActivationException: The service XYZ cannot be activated due to an exception during compilation. The exception message is: Service 'XYZ' 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.
Well, in my case the IIS site was running over https without any http binding. And web.config did have all the right settings e.g. endpoints, behaviors, ServiceMetadata httpGetEnabled="true" httpsGetEnabled="true" ....... and everything else.
Now all my google searches indicated to verify the namespace in config and code but nothing worked for me.
As my website had only HTTPS binding defined in the IIS, I added a HTTP binding and things started working after that.
Tip: To add a http or https binding, open IIS, right click on website, choose BINDINGS option, then add required binding.
Also, other reasons for this error could be
1. Namespace issues in web.config and code
2. If ServiceMetadata option's httpGetEnabled or httpsGetEnabled are set to false.