Windows phone 8 NotificationHubNotFoundException Windows Phone 8

Windows phone 8 NotificationHubNotFoundException Windows Phone 8,windows-phone-8,toast,azure-notificationhub,Windows Phone 8,Toast,Azure Notificationhub,当我试图用下面的代码在我的Windows Phone解决方案上进行基本工作时 var channel = HttpNotificationChannel.Find("MyPushChannel3"); if (channel == null) { channel = new HttpNotificationChannel("MyPushChannel3"); channel.Open(

当我试图用下面的代码在我的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());
            });
var channel=HttpNotificationChannel.Find(“MyPushChannel3”);
如果(通道==null)
{
通道=新的HttpNotificationChannel(“MyPushChannel3”);
通道打开();
channel.BindToShellToast();
}
channel.ChannelUriUpdated+=新事件处理程序(异步(o,args)=>
{
var hub=新通知中心(“http://messaging-ns.servicebus.windows.net/messagingt“,”---我的连接字符串----”;
wait hub.RegisterNativeAsync(args.ChannelUri.ToString());
});
我在等待行中收到通知HubNotFoundException,并显示以下消息

HTTP请求失败

HTTP详细信息: 现状:404 原因:找不到 完整内容:404指定地址未托管任何服务..跟踪ID:2e4b1100-18de-4b24-bbec-68516ddc3b60_G4,时间戳:2014年2月2日1:30:23 AM 我为NotificationHub构造函数的第一个参数“notificationHubPath”尝试了许多选项,但没有成功注册我的应用程序。过去任何人都曾面临过这种错误。不幸的是,没有足够的文档说明这个构造函数在MDSN中是如何工作的


谢谢

在创建
NotificationHub
类型对象时,请尝试只传递连接字符串中的hub名称,而不是整个地址:

var-hub=newnotificationhub(“Messaging”,“连接字符串-”);

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


你可以用小提琴来显示更多的信息,我忘了在我的情况下

谢谢图坦,它成功了。需要注意的是,无论您是否在代码中对其进行了更改,如果第一次出错,它只会正常工作,您都会从模拟器/设备卸载应用程序,然后再次运行它。频道似乎是第一次缓存,只有在卸载应用程序时才能更改。@NicolásJiménez如果在部署之前重建项目,它将进行干净的安装。