locked
Have I been permanently blocked? RRS feed

  • Question

  • I have an authenticated web service for push notifications.  Everything was working fine during testing.  I received numerous 412 response codes when I wasn't paying attention.  I fixed my web service to wait the required hour, but now all I get is 404s (even when using the emulator).  How do I tell if I've been permanently blocked? And if I have been, what can I do about it?
    Friday, July 6, 2012 1:17 AM

Answers

  • I do not call HttpNotificationChannel.Close() when exiting the app.  Should I be? 

    No, calling Close will discard the channel.  I asked because that is one possible cause of the error.

    As for the code you show...

      I would still test sending the notification while the application is still running.  I would also add handlers for HttpNotificationReceived and ShellToastNotificationReceived so I could verify if the notification was received. 

    Also, I would wait to call BindToShellToast and BindToShellTile until after receiving the ChannelUriUpdated event. If you bind before receiving a ChannelUri the binding may not work.


    Other thoughts:
    * Check the values you're using for ChannelName and PushServiceName on each call just to be sure they're the expected values. (... and they don't change.)
    * I see you are using a Service Name... Are you intending to use Authenticated Push? 
    * On the push server side, do you get 404 response for every call?  ... or do some calls return a different result?
    Tuesday, July 10, 2012 3:48 PM

All replies

  • It probably just de-registered that particular channel...
    Does your client app get a new ChannelUri?  (...it should be listening for ChannelUriUpdated.)
    Friday, July 6, 2012 4:23 PM
  • Thanks for replying.  My app is listening for ChannelUriUpdated.  The event handler updates the web service with the new ChannelUri  I have confirmed that when the app runs it receives a new ChannelUri (every time it launches), and the ChannelUri is properly updated on the web service.  When my web service tries to send the push a minute later with the new ChannelUri I get a 404.  If I didn't know better, I'd say MPNS is handing out subscriptions indiscriminately, but revoking mine as soon as it realizes who I am.  Conspiracies aside, I'm at a loss here.
    Saturday, July 7, 2012 1:38 AM
  • I have confirmed that when the app runs it receives a new ChannelUri (every time it launches),

    Can you give some more detail regarding the client side usage?

    ex:
    * What channel bindings are you using?
    * Is the application active when you attempt to send the notification?
    * Do you try calling HttpNotificationChannel.Find(...) when starting or do you always call HttpNotificationChannel.Open()?
    * Do you call HttpNotificationChannel.Close() when exiting your application?
    Monday, July 9, 2012 3:11 PM
  • This is where the rubber meets the road.  I have confirmed in the debugger all variables are getting set properly:
         
            void CheckPushChannel()
            {
                if (App.SettingsDB.IsOptingForPush)
                {
                    HttpNotificationChannel pushChannel = HttpNotificationChannel.Find(App.SettingsDB.ChannelName);
                    if (pushChannel == null)
                    {
                        pushChannel = new HttpNotificationChannel(App.SettingsDB.ChannelName, App.SettingsDB.PushServiceName);
                        pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
                        pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
                        pushChannel.Open();
                        pushChannel.BindToShellToast();
                        pushChannel.BindToShellTile();
                    }
                    else
                    {
                        if (pushChannel.ChannelUri == null)
                        {
                            pushChannel.Close();
                            CheckPushChannel();
                            return;
                        }

                        pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
                        pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
                        UpdateChannelUri(pushChannel.ChannelUri.ToString());
                    }
                }
            }

    PushChannel_ChannelUriUpdated calls UpdateChannelUri, which updates the ChannelUri on the web service (I have confirmed this is working by running the client app in debugger and viewing updated ChannelUri on web service).

    The app is not active when I run the web service to post to MPNS.

    I do not call HttpNotificationChannel.Close() when exiting the app.  Should I be?  I didn't see that anywhere in the docs or anyone doing it in their tutorials.

    This code used to work in the emulator and on two different devices.  Now, neither.  Obviously I'm overlooking something, but I'm too close to the problem to see it.  Thanks again for your help with this.


    Tuesday, July 10, 2012 1:19 AM
  • I do not call HttpNotificationChannel.Close() when exiting the app.  Should I be? 

    No, calling Close will discard the channel.  I asked because that is one possible cause of the error.

    As for the code you show...

      I would still test sending the notification while the application is still running.  I would also add handlers for HttpNotificationReceived and ShellToastNotificationReceived so I could verify if the notification was received. 

    Also, I would wait to call BindToShellToast and BindToShellTile until after receiving the ChannelUriUpdated event. If you bind before receiving a ChannelUri the binding may not work.


    Other thoughts:
    * Check the values you're using for ChannelName and PushServiceName on each call just to be sure they're the expected values. (... and they don't change.)
    * I see you are using a Service Name... Are you intending to use Authenticated Push? 
    * On the push server side, do you get 404 response for every call?  ... or do some calls return a different result?
    Tuesday, July 10, 2012 3:48 PM
  • THANK YOU SO MUCH!

    Your suggestion to subscribe to other events on the client lead me to the root cause, my xml payload was malformed.  This closed the channel on the client side, which resulted in subsequent 404s on the server side.  I would've expected problems with the xml to be sent back to the server.  But apparently this is not the case.  I will have to re-evaluate how I handle events on the client side and work them into the next update.

    Thanks again for your help!
    Wednesday, July 11, 2012 11:53 PM