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); } }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。