I have a WCF Service and an application with a Service Reference to it, and with the application I have a loop and in each iteration it\'s making a call to a method in this
This can be solved by creating singleton class as interface between web service reference and application. Then it will create only one instance of service reference.
class ServiceInterface
{
private static ServiceInterface _instance;
private ServiceClient _service = new ServiceClient ;
private ServiceInterface()
{
//Prevent accessing default constructor
}
public static ServiceInterface GetInstance()
{
if(_instance == null)
{
_instance = new ServiceInterface();
}
return _instance;
}
// You can add your functions to access web service here
Public int PerformTask()
{
return _service.PerformTask();
}
}