0
我找不到任何網站(是啊..我花了好幾個小時搜索/閱讀/測試),一種叫做通過返回簡單的Hello World功能,並將其顯示給用戶。Silverlight 5,從WCF Ria服務返回,VB.NET - 簡單的Hello World
這裏是我的WCF類代碼:
Imports System.ServiceModel
Imports System.ServiceModel.Activation
<ServiceContract(Namespace:="Servicio")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class ServicioBD
<OperationContract()>
Public Function ReturnString(ByVal number As Integer) As String
If number = 1 Then
Return "Hello World!"
Else
Return "Bye World!"
End If
End Function
我加入這個服務名爲 「ServicioWCF_BD」。
這是IM如何從MainPage.xaml中調用它:
Private Sub SayHello()
Dim wcf As New ServicioWCF_BD.ServicioBDClient
Dim message As String = wcf.ReturnStringAsync(1) 'ERROR THE EXPRESSION DOESNT GENERATE A VALUE
MessageBox.Show(message)
End Sub
當我試圖從功能的視覺獲取的價值說的錯誤:「表達犯規產生的價值。」
我希望你能幫助我,其實它的第一次IM的東西,看起來這麼簡單,就是爲了讓辛苦..... *嘆*
這一行: 昏暗的信息作爲字符串= wcf.ReturnStringAsync(1 )。結果 的Visual Studio 2012還稱它不產生價值,而智能感知犯規顯示「結果」 這個功能: PRIVA te異步函數SayHello()作爲任務 Visual Studio說「找不到修飾符'Async'中的所有類型。 「 感謝您的回答:) ...但我仍然無法完成這項工作.. – 2013-05-04 01:34:46
@GonzaloHeviaCastillo,** ReturnStringAsync **的簽名是什麼? – 2013-05-05 23:48:35
對於一些推薦您的代碼在Visual Studio 2010中完美並且完全更新,並且在Visual Studio 2012中不起作用。感謝您的幫助。 – 2013-05-07 23:36:39