I have created a simple silverlight application using WCF service.. My service created well and i also test the WCF service with the help of wcftestclient it works fine.. I give a service reference to silverlight also but when i run the silverlight application i can’t get the result.
here is silverlight code
void getdatacs(object sender, ServiceReference1.GetDataCompletedEventArgs e)
{
MessageBox.Show(e.Result);
}
private void button1_Click(object sender, RoutedEventArgs e)
{
ServiceReference1.Service1Client cs = new ServiceReference1.Service1Client();
cs.GetDataCompleted += new EventHandler<ServiceReference1.GetDataCompletedEventArgs>(getdatacs);
cs.GetDataAsync(Convert.ToInt32(textBox1.Text));
}
and here is my WCF code
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
can any body tell me y i can’t get the result.
Is the service hosted seperately from the SL app? If so you may need to add a clientaccesspolicy file. see this link for details