0

虽然我一直在尝试使用以下代码在我的 Windows Phone 解决方案上使用基本的通知中心教程

var channel = HttpNotificationChannel.Find("MyPushChannel3");
            if (channel == null)
            {
                channel = new HttpNotificationChannel("MyPushChannel3");
                channel.Open();
                channel.BindToShellToast();
            }

            channel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(async (o, args) =>
            {
                var hub = new NotificationHub("http://messaging-ns.servicebus.windows.net/messagingt", "---MY CONECTION STRING---");
                await hub.RegisterNativeAsync(args.ChannelUri.ToString());
            });

我在 await 行中收到 NotificationHubNotFoundException 并带有以下消息

HTTP 请求失败。

HTTP 详细信息:状态:404 原因:未找到完整内容:404指定地址没有托管服务..TrackingId:2e4b1100-18de-4b24-bbec-68516ddc3b60_G4,TimeStamp:2/2/2014 1:30:23 AM

我为 NotificationHub 构造函数的第一个参数尝试了许多选项,称为“notificationHubPath”,但没有成功注册我的应用程序。过去任何人都遇到过这个错误。不幸的是,没有足够的文档说明这个构造函数在 MDSN 中是如何工作的。

谢谢

4

2 回答 2

1

创建NotificationHub类型对象时,请尝试仅将集线器名称与连接字符串一起传递,而不是整个地址:

var hub = new NotificationHub("messagingt", "---CONECTION STRING---");
于 2014-02-02T09:30:58.273 回答
0

我遇到了同样的问题,在关闭/打开 VS2013 后,重新启动 PC 并更改 Wifi/3g 连接它再次像以前一样工作......奇怪,我想这是一个互联网连接问题。

您可以使用提琴手来显示更多信息,我忘记了...

于 2014-06-14T16:08:10.660 回答