public class Service1 : IService1 { public string DoWork() { OperationContext operationContext = OperationContext.Current; MessageProperties messageProperties = operationContext.IncomingMessageProperties; RemoteEndpointMessageProperty remoteEndpointProperty = messageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty; return string.Format("Your IP address is {0} and your port is {1}",remoteEndpointProperty.Address, remoteEndpointProperty.Port); } } public partial class Page : UserControl { public Page() { InitializeComponent(); ServiceReference1.Service1Client client=new GridSplitterSample.ServiceReference1.Service1Client(); client.DoWorkCompleted += new EventHandler<GridSplitterSample.ServiceReference1.DoWorkCompletedEventArgs>(client_DoWorkCompleted); client.DoWorkAsync(); } void client_DoWorkCompleted(object sender, GridSplitterSample.ServiceReference1.DoWorkCompletedEventArgs e) { TextBlock myBlock=new TextBlock(); myBlock.Text=e.Result; LayoutRoot.children.Add(myBlock); } }