Friday, February 10, 2017

Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

When we get the above error after updating the Newtonsoft.Json library from the NuGet package manager or installing it. The solution to the problem is that first delete all the reference from the project or delete the DLL files from the project and then try to install the library again and then check. It worked for me after updating the Newtonsoft.Json library from NuGet package manager console
Update-Package Newtonsoft.Json
Or try this
 Update-Package –reinstall Newtonsoft.Json

To send push notification's to IOS device

To send push notifications to the IOS devices from WCF service we need to first install the push sharp  and the Newtonsoft.Json library from the NuGet package manager

To install the push sharp from package manager console type the following command 
Install-Package PushSharp
https://www.nuget.org/packages/PushSharp/
To install the Newtonsoft.Json from package manager console type the following command
 Install-Package Newtonsoft.Json
https://www.nuget.org/packages/Newtonsoft.Json/9.0.2-beta2 

After installing the package write the following code to send the notifications.



using Newtonsoft.Json.Linq;
using PushSharp.Apple;

  public void IosPushNotifications()
        {
            var certificate = File.ReadAllBytes("Add your certificate location");
            var configuration = new PushSharp.Apple.ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox, certificate, "your certificate password");

            var ServiceBroker = new ApnsServiceBroker(configuration);

            string message = "Your message";
            ServiceBroker.Start();
            ServiceBroker.QueueNotification(new ApnsNotification
            {
                DeviceToken = "18545dd4eredf47834e4er4exxxxxxxxxxxxxxxxxxxxxxxxx",//your device token
                Payload = JObject.Parse("{'aps':{'badge':1,'sound':'oven.caf','alert':'" + message + "'}}")
            });

            ServiceBroker.Stop();
        }

Git Commands

Git Version   To check the git version Git -v       Git Clone To clone the repository, use the following command: Git clone [u...