我们正试图测试推送通知,使用从文档的最新代码如何:设置为Windows Phone的WP7:推送通知通道URI是空
public HttpNotificationChannel myChannel;
public void CreatingANotificationChannel()
{
myChannel = HttpNotificationChannel.Find("MyChannel");
if (myChannel == null)
{
myChannel = new HttpNotificationChannel("MyChannel","www.contoso.com");
// An application is expected to send its notification channel URI to its corresponding web service each time it launches.
// The notification channel URI is not guaranteed to be the same as the last time the application ran.
myChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(myChannel_ChannelUriUpdated);
myChannel.Open();
}
else // Found an existing notification channel.
{
// The URI that the application sends to its web service.
Debug.WriteLine("Notification channel URI:" + myChannel.ChannelUri.ToString());
}
myChannel.HttpNotificationReceived += new EventHandler<HttpNotificationEventArgs>(myChannel_HttpNotificationReceived);
myChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(myChannel_ShellToastNotificationReceived);
myChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(myChannel_ErrorOccurred);
}
通知通道如果HttpNotificationChannel.Find()返回null,它会打开一个新频道,但ChannelUriUpdated事件从不触发。
如果HttpNotificationChannel.Find()返回一个通道,则ChannelUri属性为null。示例代码在这里崩溃,因为它假定ChannelUri属性不为null。
在任何情况下都不会触发ErrorOccurred事件。
我该如何解决这个问题?这个问题是由于微软服务器或其他东西?
Thnks提前
编辑 等待重播,十天后我很痛苦空URI问题 任何一个可以告诉我,我怎么能解决这个问题一段时间MSPN服务器给予chanalk URI ANS一些时间不是我的意思有些时候它给null引用异常。 微软在做什么?
等待回复 – MansinhDodiya 2013-04-04 08:13:34