Click here to Skip to main content
13,634,012 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,
I have a sample wcf msmq service as shown below.
    public interface IService1
        [OperationContract(IsOneWay = true)]
        void SendCreditLimitRequest(string id);

public class Service1 : IService1
public void SendCreditLimitRequest(string id)
double value;

if (id == "1")
value = 10;
else if (id == "2")
value = 20;
value = 0;

      <service name="MSMQService.Service1">
            <add baseaddress="http://localhost:8000/msmqservice" />
        <endpoint address="net.msmq://localhost/private/requestqueue">
            <dns value="localhost" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

Now, if i run this service through wcftestclient it works fine. I am trying to host this service in one windows form.
ServiceHost myServiceHost = null;
private void button1_Click(object sender, EventArgs e)
myServiceHost = new ServiceHost(typeof(ServiceReference1.Service1Client));
MessageBox.Show("Service Started!");
private void button2_Click(object sender, EventArgs e)
if (myServiceHost.State != CommunicationState.Closed)
MessageBox.Show("Service Stopped!");

However, i am getting below error.
Service 'ClientForService.ServiceReference1.Service1Client' 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 have seen n number of forums. Everywhere it is mentioned, we need to service name correct i.e. namespace and implemented class name. I have checked that also. But, still not able to make it work. I would really appreciate it if someone can help me in this ?
Posted 19-May-15 4:54am
Updated 19-May-15 4:58am
virusstorm 19-May-15 14:22pm
Did you add an entry in your client configuration file (app.config) for the WCF service? If so, what does your client configuration file look like?
25-May-15 5:08am
I am yet to host the service. Whenever i am trying to host the service through service host, getting this error. my host is a simple windows app. app.config file is whatever generated automatically when i added my service reference. I have not made any changes in it. But, still not able to make it work. Pls let me know if you need any more information on this.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.180712.1 | Last Updated 19 May 2015
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100