I have a WCF service Service1 that has a service reference to another WCF service Service2.
Both services are self hosted and can be accessed normally when not referencing one another.
Inside a method in Service1 I have a call to the other service
public String DoWork()
{
using(Service2Client client = new Service2Client())
{
return client.DoWork();
}
}
The method containing this code is called from another project referencing Service1 like so:
using (Service1Client client = new Service1Client())
{
result = client.DoWork();
}
When this project attempts to consume the service I get an error message:
System.ServiceModel.FaultException`1: 'Could not find default endpoint element that references contract 'Service2Reference.IService2' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.'
Any ideas on how to fix this? I am fairly inexperienced with WCF.
I have read about adding the endpoint but I'm not entirely sure which config file to add it to (e.g. the client which makes the call or the host of the service which calls another service)?
Thanks