HttpNotificationChannel throws on Open with InvalidOperationException
I'm lost and don't understand what's going on.
I'm trying to open a Notification Channel and it throws an
InvalidOperationException with the following message:
Open failed because the channel was already open. You can find an open
channel by calling the Find method.
Of course, I do use HttpNotificationChannel.Find(channelName) and it
returns null. Also, the newly created channel's ConnectionStatus is
Connected ?!
Here's the code:
var channelName = "dfjDFUDFDKJLKJKKJDFDFDF";
var currentChannel = HttpNotificationChannel.Find(channelName);
if (currentChannel == null)
{
currentChannel = new HttpNotificationChannel(channelName);
}
currentChannel.ChannelUriUpdated += new
EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
currentChannel.ErrorOccurred += new
EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
currentChannel.HttpNotificationReceived += new
EventHandler<HttpNotificationEventArgs>(PushChannel_HttpNotificationReceived);
currentChannel.Open(); // ERROR
I'm running this on the device, not emulator.
No comments:
Post a Comment