15

i keep getting an unexplained exception

 Service 'EmployeeManagerImplementation.EmployeeManagerService' 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.

iv'e come across other posts which have solved this problem , but no one seems to have a precise answer , and non of their solutions worked for me .

Service has zero application (non-infrastructure) endpoints

any ways here's my app.config

 <system.serviceModel>
    <services>
        <service name="Some.Test.EmployeeManagerService">
            <endpoint address="net.tcp://localhost:8080/Service" binding="netTcpBinding"
                bindingConfiguration="" contract="Contracts.IEmployeeManagerService" />
            <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
        </service>
    </services>
</system.serviceModel>

my Contract:

[ServiceContract(Namespace="Some.Test")]
public interface IEmployeeManagerService
{
    [OperationContract]
    string Test();    
}

My Service :

public class EmployeeManagerService : IEmployeeManagerService
{
    public string Test()
    {
        return "test";
    }
}

in the related post people advised to give the Contract a namespace , and to use that as a prefix in my app.config for the name in the service tab .

also there was a suggestion to expose the mex end point ... i don't really see what this as to do with it but i did it any ways .

so any ideas of why this happens ? and how to really resolve this issue ?

Community
  • 1
  • 1
eran otzap
  • 12,293
  • 20
  • 84
  • 139
  • 6
    o'k turns out it is needed to give the name attribute of the service the same exact name as the implementation including namespace thanks to @Johann Blais http://stackoverflow.com/questions/5270956/service-x-has-zero-application-endpoints-unless-i-add-an-endpoint-in-code-wh – eran otzap Mar 21 '12 at 23:34
  • 2
    You should add this as an answer and accept it. – flayn Sep 07 '12 at 15:12
  • i put a link to the answer which helped me ... just as good :) – eran otzap Sep 08 '12 at 12:25

5 Answers5

11

From your own comment:

Set the name attribute of the service to the exact same name as the implementation including the namespace

<service name="EmployeeManagerImplementation.EmployeeManagerService">

Phil Patterson
  • 1,242
  • 15
  • 25
2

Copy app.config from service to console app which is hosting the service

If you have created the service as a class library project and you are using console application to host it then just copy the app.config file from the service into the console application

ziaprog
  • 1,497
  • 1
  • 10
  • 11
  • why do you think that the app.config is not placed in the correct place ? even i asked this question 3 years ago. i just read it and i don't see how you concluded that that's the problem. my first comment describes how i solved it. – eran otzap Jul 15 '15 at 07:22
  • This one solved issue for me. The reason is I've separated service contracts and installer. So I didn't realize my service installer needs config as well. Upvoting this answer. – Bassist Aug 02 '16 at 05:09
1

The name of the service should be same as the class file that implement the interface i.e Interface.

    namespace WCFDemo
{
    public interface IWorker
    {
    }
}

and suppose you implemented it as

namespace WCFDemo
{
   public class WorkHere:Iworker
  {
  }
}

Then service name would be <service name="WCFDemo.WorkHere">

nbi
  • 1,276
  • 4
  • 16
  • 26
1

For my issue, I had all the namespaces set correctly as well. But what I failed to do was add a basicHttpBinding endpoint for the service itself. See this MSDN article, the first XML config section for an example.

Pflugs
  • 772
  • 1
  • 10
  • 18
0

I faced the same problem with my wcf soap application when deploying in https.

I fixed it by using this config in web.config: This link helped me to find the solution

<system.serviceModel>
 <services>  
      <service name="MyWebService.Service1">  
        <endpoint address=""  
                  binding="basicHttpBinding"  
                  bindingConfiguration="secureHttpBinding"  
                  contract="MyWebService.IService1"/>  

        <endpoint address="mex"  
                  binding="mexHttpsBinding"  
                  contract="IMetadataExchange" />  
      </service>  
</services>  
    <bindings>
      <basicHttpBinding>        
        <binding name="secureHttpBinding">  
          <security mode="Transport">  
            <transport clientCredentialType="None"/>  
          </security>  
        </binding>  
      </basicHttpBinding>
    </bindings>
   
    <behaviors>
      <serviceBehaviors>
        <behavior>
          
          <serviceMetadata httpGetEnabled="false"/>             
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
     
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>        
  </system.webServer>
Kemal AL GAZZAH
  • 967
  • 6
  • 15