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)
if (id == "1")
value = 10;
else if (id == "2")
value = 20;
value = 0;
<add baseaddress="http://localhost:8000/msmqservice" />
<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));
private void button2_Click(object sender, EventArgs e)
if (myServiceHost.State != CommunicationState.Closed)
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 ?