Public class service1: iservice1 {Public String dowork () {operationcontext = operationcontext. current; 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 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 );}}