我只是silverlight和WCF的入門者。我遇到了Miguel A. Castro撰寫的一篇很好的文章here,該文章教導瞭如何手動添加WCF。我有合同服務設置,我唯一留下的就是從銀牌服務中獲取數據。我很難將代碼翻譯成vb.net。WCF無需在vb中添加服務引用
BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
EndpointAddress endpointAddress = new EndpointAddress("/Person.svc");
IPersonService personService = new ChannelFactory<IPersonService>(basicHttpBinding, endpointAddress).CreateChannel();
//+
AsyncCallback asyncCallBack = delegate(IAsyncResult result)
{
Person person = ((IPersonService)result.AsyncState).EndGetPersonData(result);
this.Dispatcher.BeginInvoke(delegate
{
spMain.Children.Add(new TextBlock
{
Text = person.FirstName
});
});
};
personService.BeginGetPersonData("F488D20B-FC27-4631-9FB9-83AF616AB5A6", asyncCallBack, personService);
AsyncCallback asyncCallBack = delegate(IAsyncResult result) {
和
this.Dispatcher.BeginInvoke(delegate {
應該如何在vb.net寫?
感謝您的幫助。
使用渠道工廠 – 2013-06-11 10:16:12