locked
Are Live Tile Push Notifications Broken? RRS feed

  • Question

  • Hi,

    We have been having an issue with Live Tile push notifications the past few days.  It would seem that none of my user's tiles are being updated any longer.  Other notifications are working fine.  Here is the exception I am seeing on the client:

    Exception: MessageBadContent - A remote URL was specified in the tile notification payload and one of the following conditions was not met: 1) It was not http://, 2) the host name exceeded 256 characters, 3) the URL exceeded 2055 characters, 4) the domain was not specified in the allowed domains collection.

    We are seeing no issues server-side.  We haven't changed our code and have not had any issues until a few days ago.  Are others seeing this as well?

    Thanks,

    Brian P Hamachek
    President & CEO
    SynergeTech Solutions, Inc
    Saturday, October 15, 2011 1:28 AM

Answers

  • Hello Eric,

    Thanks for responding to my question.  I have actually already determined the cause of the problem.  The URL to our remote tile background image had changed and began to contain an ampersand (&) character in the query string portion of the URL.  

    For example: http://www.domain.com/image.png?id=1&foo=true

    After reviewing the msdn documentation, we learned that the ampersand needed to be XML encoded.

    For example: http://www.domain.com/image.png?id=1&foo=true

    We attempted this, however this did not fix the issue.  Ultimately, we removed the 2nd query string parameter as it was not necessary.  Removing the ampersand resolved the issue for us.  Looks like this is probably either a bug in the push notification system or an error in the documentation.

    Hope that is helpful.  Thanks,

    Brian P. Hamachek
    President & CEO
    SynergeTech Solutions, Inc
    Tuesday, October 18, 2011 11:15 AM

All replies

  • The error indicates that the client successfully received and processed the notification but that the notification content contained one or more values which were outside of allowable range.

    As the error suggests, you need to check the message content to determine the cause... 

    Can you post the content of one of the failing notifications?
    Monday, October 17, 2011 2:53 PM
  • Hello Eric,

    Thanks for responding to my question.  I have actually already determined the cause of the problem.  The URL to our remote tile background image had changed and began to contain an ampersand (&) character in the query string portion of the URL.  

    For example: http://www.domain.com/image.png?id=1&foo=true

    After reviewing the msdn documentation, we learned that the ampersand needed to be XML encoded.

    For example: http://www.domain.com/image.png?id=1&foo=true

    We attempted this, however this did not fix the issue.  Ultimately, we removed the 2nd query string parameter as it was not necessary.  Removing the ampersand resolved the issue for us.  Looks like this is probably either a bug in the push notification system or an error in the documentation.

    Hope that is helpful.  Thanks,

    Brian P. Hamachek
    President & CEO
    SynergeTech Solutions, Inc
    Tuesday, October 18, 2011 11:15 AM
  • That's odd... are you sure nothing else changed in the Uri?

    I tested this myself and had no problem with the ampersand. 
    ...Though I did get that error at first because I forgot to add the domain to my collection allowed Uri's, passed to BindToShellTile().

    I tested using a Uri string like the following:  

    @"http://www.somedomain.com/GetImg.aspx?id=1&file=jupiter.png"

    FYI: I use the XMLWriter class to construct my push message.  The XMLWriter.WriteValue method automatically encodes the string so I don't have to add any extra code.

    ex:

     

    private static byte[] prepareTilePayload(string tokenId, string backgroundImageUri, int count, string title)  
    {  
        MemoryStream stream = new MemoryStream();  
     
        //byte[] prefix = Encoding.UTF8.GetBytes("Content-Type: text/xml\r\nX-WindowsPhone-Target: token\r\n\r\n");  
        //stream.Write(prefix, 0, prefix.Length);  
     
        XmlWriterSettings settings = new XmlWriterSettings() { Indent = true, Encoding = Encoding.UTF8 };  
        XmlWriter writer = XmlWriter.Create(stream, settings);  
        writer.WriteStartDocument();  
        writer.WriteStartElement("wp""Notification""WPNotification");  
        writer.WriteStartElement("wp""Tile""WPNotification");  
        writer.WriteStartElement("wp""BackgroundImage""WPNotification");  
        writer.WriteValue(backgroundImageUri);  
        writer.WriteEndElement();  
        writer.WriteStartElement("wp""Count""WPNotification");  
        writer.WriteValue(count.ToString());  
        writer.WriteEndElement();  
        writer.WriteStartElement("wp""Title""WPNotification");  
        writer.WriteValue(title);  
        writer.WriteEndElement();  
        writer.WriteEndDocument();  
        writer.Close();  
     
        stream.Seek(0, 0);  
        StreamReader sr = new StreamReader(stream);  
        System.Diagnostics.Debug.WriteLine(sr.ReadToEnd());  
     
        byte[] payload = stream.ToArray();  
        return payload;  

    Tuesday, October 18, 2011 6:40 PM