I am trying to write a code activity which uses service discovery to locate a discoverable service. I created a service contract and config file for the service using svcutil. Then I added the generatedproxy.cs (this is the name i gave to it) and app.config files to my code activity project. I am using the following code in the code activity to access the service
DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint());
FindResponse findResponse = discoveryClient.Find(new FindCriteria(typeof(IService1)));
if (findResponse.Endpoints.Count > 0)
{
EndpointAddress address= findResponse.Endpoints[0].Address;
Service1Client client = new Service1Client();
client.Endpoint.Address = address;
}
But an error occurs when it comes to the code Service1Client client = new Service1Client(); The error message is
Could not find default endpoint element that references contract 'IService1' 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.
Can someone please help me to solve this problem?