如何解决异常:等待操作超时.(HRESULT: 0x80070102的异常)



当调用PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();方法时,我得到这个异常。在设备上工作正常,但在本地机器上失败。

这是我的代码:

private async void CreateChannel_Click(object sender, RoutedEventArgs e)
       {
var vProfile = NetworkInformation.GetInternetConnectionProfile();
            System.Diagnostics.Debug.WriteLine("InterNetConnectivity==>>" + vProfile.GetNetworkConnectivityLevel().ToString());
            UserResponseTBL.Text = vProfile.GetNetworkConnectivityLevel().ToString();
            if (vProfile.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess)
            {
                var vChannel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
                string channelUri = vChannel.Uri;
                UserResponseTBL.Text = channelUri;
                System.Diagnostics.Debug.WriteLine("channelUri : " + channelUri);
            }
        }

我得到了异常等待操作超时。(HRESULT: 0x80070102的异常)。任何帮助将不胜感激。谢谢

我通过在设备/不同的机器上运行上述代码解决了这个问题。

出现这个问题是因为我在我的机器上安装了不同版本的Visual studio。不知道这个问题的真正原因,但是当我把我的机器升级到windows 10时,它可以工作。