当我在 webform 或 MVC 系统中使用此代码时,保持挂起并留在这行代码中:
AppleRegistrationDescription vb =
await hubClient.CreateAppleNativeRegistrationAsync(token, new string[] { tag });
但在控制台中工作正常
这是我的代码
static async Task<AppleRegistrationDescription> appleregister(string tag, string token)
{
var hubClient = NotificationHubClient.CreateClientFromConnectionString("Endpoint=sb://ipluzservicehub.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=o9DAUFuT1n9AyHfuc8REkwo0W/65WAw1SSG+fNJ/xqg=", "taylors");
AppleRegistrationDescription vb = await hubClient.CreateAppleNativeRegistrationAsync(token, new string[] { tag });
return vb;
}
public ActionResult Index()
{
try
{
Task<AppleRegistrationDescription> t = appleregister("MYTag", "19606e2xxxxxxxxxxxxxxxxxx");
var list = t.Result;
var id = list.RegistrationId;
}
catch
{
}
return View();
}
谁能帮帮我