The first exception of type "System.UnauthorizedAccessException" exception occurred in Microsoft.Phone.ni.dll

I have a Windows Phone 8 application running on its emulator from Visual Studio 2012. I implemented the logic to be able to send push notifications for this application. When it comes to the code snippet below in the MainPage constructor, I get the exception indicated in the subject line:

// try to find the channel pushChannel = HttpNotificationChannel.Find(channelName); 

In addition, the information below is issued with the exception of:

Access to push notifications requires the identifier ID_CAP_PUSH_NOTIFICATION, which must be defined in the manifest.

What could be wrong or missing that I get such an exception. Please note that I am running the VS 2012 environment as an administrator with full privileges.

Thanks!

+4
source share
1 answer

In Visual Studio Solution Explorer

  • Expand the "Properties" node of the project.
  • Open the WMAppManifest.xml file in the Properties panel.
  • Go to the Features tab
  • If it is not installed, check the "ID_CAP_PUSH_NOTIFICATION" button.
+12
source

Source: https://habr.com/ru/post/1479766/


All Articles