Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just started with WCF Service application where i am getting an exception i tried to resolve it but it shows there as an exception in endpoint address the below is my code with config fie, kindly he me to figure out the exception

XML
<system.serviceModel>
   <services>
     <service name="CompanyService.CompanyService" behaviorConfiguration="mexbehaviour">
       <endpoint address="/CompanyService" binding="basicHttpBinding"  contract="CompanyService.ICompanyPubicService"></endpoint>
       <endpoint address="/CompanyService" binding="netTcpBinding"  contract="CompanyService.IComanyConfidentialService"></endpoint>
       <host>
         <baseAddresses>
           <add baseAddress="http://localhost:8080/"/>
           <add baseAddress="net.tcp://localhost:8090/"/>
         </baseAddresses>
       </host>
     </service>
   </services>
   <behaviors>
     <serviceBehaviors>
       <behavior name="mexbehaviour">
         <serviceMetadata httpGetEnabled="true"/>
       </behavior>
     </serviceBehaviors>
   </behaviors>
 </system.serviceModel>


C#
namespace CompanyService
{
    public class CompanyServie:ICompanyPubicService,IComanyConfidentialService
    {
        public string GetPublicInformation()
        {
            return "Public Information via HTTP";
        }

        public string GetConfidentialInformation()
        {
            return "Confidential Information via TCP";
        }
    }
}


C#
namespace CompanyService
{
    [ServiceContract]
    public interface ICompanyPubicService
    {
        [OperationContract]
        string GetPublicInformation();
    }
    [ServiceContract]
    public interface IComanyConfidentialService
    {
        [OperationContract]
        string GetConfidentialInformation();
    }
}


below is an error occurring
System.ServiceModel.dll

Additional information: Service 'CompanyService.CompanyServie' 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.

If there is a handler for this exception, the program may be safely continued.
Posted
Updated 14-Jan-15 0:19am
v5

1 solution

You seem to have a typo in the class definition in your source code, in the following line:

C#
public class CompanyServie:ICompanyPubicService,IComanyConfidentialService


The class name is spelled differently from your config file:

<service name="CompanyService.CompanyService" behaviorConfiguration="mexbehaviour">


This is most likely the cause of the exception.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900