I am not able to retrieve the result from the WCF web service. The result is always null.
Here is my Silverlight client code:
TTServiceClient client1 = new TTServiceClient();
client1.GetUserNameCompleted += new EventHandler<GetUserNameCompletedEventArgs>(client1_GetUserNameCompleted);
client1.GetUserNameAsync();
void client1_GetUserNameCompleted(object sender, GetUserNameCompletedEventArgs e)
{
txtUserName.Text = e.Result;
}
My web service implementation looks like:
public string GetUserName()
{
return System.Web.HttpContext.Current.User.Identity.Name.ToString();
}
But I am able to get the result in wcf service.
The Silverlight webservice will not throw any exceptions regardless if the request was successful or not. In your callback you should, however, always check for errors the
eventargs e.Errors, in your case something like:Supposedly
e.Errorwill tell you more about the problem.