I have a WCF Service application project , a class library project(acts as a proxy betwen the service and the client) and a Asp.net web project.
Now in the WCF Service application project, I have the method GetData(int) [the default one]
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
}
I complied the WCF service project and found it working and henceforth added that as service reference to the Class library project. And written a method as under to fetch the value from the service
public string GetResult(int number)
{
string result = "";
try
{
Service1Client sc = new Service1Client();
result = sc.GetData(number);
}
catch (Exception ex)
{
var message = ex.Message;
}
return result;
}
Now this method is being invoked from the Web application. At runtime I am getting an exception
Could not find default endpoint element that references contract 'ServiceReference1.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.
The error is happening at Service1Client sc = new Service1Client();
All the config files are in place....Should I have to create the proxy using SVC util?
What am I missing?
Are you sure you have apropriate configuration for wcf placed in web.config? It seems you don't.