从vb.net运行的异步任务

问题描述 投票:2回答:1

我在C#中创建了类库

static private async Task addMeeting(string subject, int roomId,bool coffee, bool receptionist, bool valetParking, string deductedFrom, string program)
{
await GetToken();
//some code with await
} 

static async Task<string> GetToken()
{
 //some code with await
}

等待时出错enter image description here

然后我在vb.net的Web应用程序中引用此类,

addMeeting("30 Minutes Booking",1,true,false,false,"","").GetAwaiter().GetResult()

但是它永远不会运行,也不会给我我做错的任何错误

c# vb.net .net-4.5
1个回答
0
投票
Protected Async Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Await (addMeeting("MPP Test By Milind with API", 1, False, True, False, "", "")) End Sub

感谢您的帮助

© www.soinside.com 2019 - 2024. All rights reserved.