I have a Winforms client with a service referance to a WCF service that have created and is being hosted on IIS7. There is nothing else in the Form, I just added code to Form_Load event to test. In the winforms client, if I call the defualt operation GetData(int) it returns correct value.. Calling my own I always get null.... (No exceptions)
Now, the WCF service is using Linq To SQL DataContext.. In the WCF Test Client my operations work as expected when they are invoked... (as well as the default operations).
Any help would be greatly appreciated!
Now, the WCF service is using Linq To SQL DataContext.. In the WCF Test Client my operations work as expected when they are invoked... (as well as the default operations).
Any help would be greatly appreciated!
Code:
[OperationContract]
Employee GetEmployee(string employeeID);
/////////////////// Sample from Service Code ////////////////
public Employee GetEmployee(string employeeID)
{
Employee emp = new Employee();
using (DataClasses1DataContext dc = new DataClasses1DataContext())
{
try
{
emp = dc.Employees.Where(e => e.EmployeeID == employeeID).First();
dc.Dispose();
}
catch (Exception msg)
{
System.Diagnostics.Debug.Print(msg.Message);
dc.Dispose();
}
}
return emp;
}
///////////////////////// Code in Winform /////////////////////
private void Form1_Load(object sender, EventArgs e)
{
ServiceReference1.Employee emp = new WindowsFormsApplication1.ServiceReference1.Employee();
ServiceReference1.Service1Client client = new WindowsFormsApplication1.ServiceReference1.Service1Client();
string str = client.GetData(1); // Returns "You Entered 1"
emp = client.GetEmployee("John Q Public"); // Returns NULL....
client.Close();
}
Comment