0
Answer

Please help: Error with zero application (non-infrastructure) endpoints.

Lawrence

Lawrence

14y
3.3k
1


I've very new to using WCF.  I've been following a number of tutorials, but try as I might I keep getting stuck on the same error. 

"Service 'CoreSiX.Implementation.SiXAdmin' 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 guessing this is down to my configuration but I'm unsure exactly what's wrong.  I've listed the code below.  Any canone give me any pointers?

/* Service.cs */
using
System;
using
System.ComponentModel;
using
System.Configuration;
using
System.Configuration.Install;
using
System.ServiceModel;
using
System.ServiceModel.Description;
using
System.ServiceProcess;
using
CoreSiX.Implementation;
using
CoreSiX.ServiceContracts;
 
namespace
CoreSiX {
   class CoreSiXService : ServiceBase {
      public ServiceHost host = null;
      public CoreSiXService() {
         ServiceName =
"CoreSiX_Service";
      }
 
      public static void Main(){
         System.Diagnostics.
Debugger.Launch();
         ServiceBase.Run(new CoreSiXService());
      }
 
      protected override void OnStart(string[] args){
         if (host != null)
            host.Close();
         host =
new ServiceHost(typeof(SiXAdmin));
         host.Open();
      }

 
      protected override void OnStop(){
         if (host != null){
            host.Close();
            host =
null;
         }
      }
   }
 
   [
RunInstaller(true)]
   public class CoreSiXServiceInstaller : Installer {
      private ServiceProcessInstaller process;
      private ServiceInstaller service;
 
      public CoreSiXServiceInstaller() {
         process=
new ServiceProcessInstaller();
         process.Account=
ServiceAccount.LocalSystem;
         service=
new ServiceInstaller();
         service.ServiceName=
"CoreSiX_Service";
         Installers.Add(process);
         Installers.Add(service);
      }
   }
}
 
/* ISiXAdmin.cs */
using
System;
using
System.Collections.Generic;
using
System.ServiceModel;

 
namespace
CoreSiX.ServiceContracts {
   [
ServiceContract(Namespace = "http://PiE.ServiceModel.CoreSiX")]
   public interface ISiXAdmin {

      [
OperationContract]
      int Login(string username, string password);
   }
}
 /* SiXAdmin.cs */
using
System;
using
System.Collections.Generic;
using
System.Data;
using
System.Data.Common;
using
System.ServiceModel;
using
System.Text;
using
Microsoft.Practices.EnterpriseLibrary.Data;
using CoreSiX.ServiceContracts;

 
namespace
CoreSiX.Implementation {
   class SiXAdmin : ISiXAdmin {
      private const string connectionString="system";
      private readonly Microsoft.Practices.EnterpriseLibrary.Data.Database database=DatabaseFactory.CreateDatabase(connectionString);

      public int Login(string username, string password) {
         /* Implementation is here */
      }
   }
}
 /* App.config */
<?
xml version="1.0" encoding="utf-8" ?>

<configuration>

      <connectionStrings>

         <add name="system" connectionString="" providerName="System.Data.SqlClient" />

      </connectionStrings>

      <system.serviceModel>

         <bindings>

            <basicHttpBinding>

               <binding name="default" closeTimeout="00:01:00" />

            </basicHttpBinding>

         </bindings>

         <behaviors>

            <endpointBehaviors>

               <behavior name="default">

                  <callbackDebug includeExceptionDetailInFaults="true" />

               </behavior>

            </endpointBehaviors>

         </behaviors>

         <services>

            <service name="CoreSiX.CoreSiXService">

               <endpoint address="http://localhost:8000/CoreSiX/Admin/" binding="basicHttpBinding" bindingConfiguration="default" behaviorConfiguration="default" contract="CoreSiX.CoreSiX.ISiXAdmin" />

            </service>

         </services>

      </system.serviceModel>
</
configuration>