我构建了一个Web服务(" InvStatus"),它包含以下单个函数:
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Threading.Tasks
<WebService(Namespace:="http://example.com/InvStatus/", Name:="InvStatus",
Description:="the description")>
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Public Class InvStatus
Inherits System.Web.Services.WebService
Public Structure CustomReturnStruct
Dim firstItem As String
Dim secondItem As integer
End Structure
<WebMethod()>
Public Async Function LookupAsync(ByVal itemCode As String)
As Task(Of CustomReturnStruct)
Dim result As New CustomReturnStruct
' ... look up the item, and stuff the results into
' result.firstItem and result.seconditem
' ...
return result
End Function
End Class
服务编译正常,但当我尝试从另一个程序中调用它作为Web引用时:
dim myWebSvc As New com.example.InvStatus
--> Dim result As CustomReturnStruct = Await myWebSvc.LookupAsync("test123") <--
...给出了一个编译错误,说“等待”#39;要求TaskOfCustomReturnStruct类型具有合适的GetAwaiter方法
我做错了什么? (以及GetAwaiter方法是什么?)