使用示例代码推送通知时出现 404 错误
我从应用程序中获取了我的网址。它的开头是:
http://sn1.notify.live.net/throttledthirdparty/01.00/
如果我使用浏览器导航到该 URL,我会收到消息:
Microsoft Push Notification Server
然后我获取了 Microsoft 提供的代码。
http://msdn.microsoft.com/en-us/library/ff402545%28v=VS.92%29.aspx
如果我采用 C# 代码,并按原样使用它(仅更改 URL,将有效负载更改为空字节数组,并将“”字符串更改为 Guid.NewGuid().ToString(),
我每次都会收到 404。
因为我没有从浏览器中收到 404,所以内容一定很重要,并且推送通知服务器依赖于内容,因此如果我通过删除通知消息并添加(按照他们的建议)将其更改为简单的原始通知:
byte[] notificationMessage = new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
sendNotificationRequest.Headers.Add("X-NotificationClass", "13");
我仍然得到一个404 每次我都尝试做 toast 通知,但结果都是一样
。
I got my url from the app. It begins with:
http://sn1.notify.live.net/throttledthirdparty/01.00/
and if I navigate to that URL using a browser, I get the message:
Microsoft Push Notification Server
I then grabbed the code provided by Microsoft.
http://msdn.microsoft.com/en-us/library/ff402545%28v=VS.92%29.aspx
If I take the C# code, and use it as is (changing only the URL, the Payload to be an empty byte array, and changing the "" string to Guid.NewGuid().ToString()
I get a 404 every time.
Because I don't get a 404 from by browser, the content must matter, and the push notification servers are dependent on content, so if I change it to a simple raw notification by removing the notification message and adding (as they recommend):
byte[] notificationMessage = new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
sendNotificationRequest.Headers.Add("X-NotificationClass", "13");
I still get a 404 every time. I've tried doing toast notifications with the same result.
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您收到 404 的原因是您发送的 notificationMessage 数据不是它所期望的。尝试一下,看看是否有效。
您可以在这里找到教程:
http://benjii. me/2011/04/push-notifications-in-windows-phone-7-3-push-that-notification/
The reason you are getting a 404 is because the notificationMessage data you are sending isn't what it's expecting. Try this out and see if it works.
You can find a tutorial here:
http://benjii.me/2011/04/push-notifications-in-windows-phone-7-3-push-that-notification/
在将 toast 通知绑定到 shell 后,我最终让我的工作正常工作。我有一个方法可以做到这一点,但在某些情况下没有调用该方法。
I ended up getting mine to work after binding toast notifications to the shell. I had a method which did it, but under some cases wasn't calling that method.