0

While I´ve been trying to make the basic notification hub tutorial work on my Windows Phone solution with the following code

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());
            });

I get a NotificationHubNotFoundException in the await line with the following message

HTTP request failed.

HTTP Details: Status: 404 Reason: Not Found Full content: 404No service is hosted at the specified address..TrackingId:2e4b1100-18de-4b24-bbec-68516ddc3b60_G4,TimeStamp:2/2/2014 1:30:23 AM

I tried a number of options for the first parameter of the NotificationHub constructor called "notificationHubPath" with no luck to get my app registered. Anyone has faced this error in the past. Unfortunately there are not enough documentation in how does this constructor works in MDSN.

Thanks

iamnicoj
  • 487
  • 7
  • 13

2 Answers2

1

When creating the NotificationHub type object, try by passing just the hub name with the connection string, not the whole address:

var hub = new NotificationHub("messagingt", "---CONECTION STRING---");
anderZubi
  • 6,414
  • 5
  • 37
  • 67
  • Thanks Tutan, it worked. The caveat is that no matter if you change it in your code, if you got it wrong the first time it will only work it you uninstall the APP from the emulator/device and run it again. It seems that the channel is cache the first time and can only be change if you uninstall the APP. – iamnicoj Feb 03 '14 at 15:24
  • @NicolásJiménez if you Rebuild the project before you deploy it, it will do a clean install. – anderZubi Feb 03 '14 at 15:36
0

I had the same issue, and after close/open VS2013, restart PC and change Wifi/3g connection it worked again like before... strange, i suppose that was a internet connection issue.

you can use fiddler to show more information, i forgot in my case...

saramgsilva
  • 734
  • 1
  • 7
  • 17