Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Getting error as"Could not load file or assembly 'NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c' or one of its dependencies. The system cannot find the file specified." my code below:

What I have tried:

C#
PushNotification push;
        List<NotificationPayload> p;
        private string _authTokenString = String.Empty;
        private string _updatedAuthTokenString = String.Empty;
        private string _message = String.Empty;
        public static string authTokenString;
        private static readonly string PostWebRequest = "POST";
        private static readonly string AuthTokenHeader = "Auth=";
        private static readonly string UpdateClientAuth = "Update-Client-Auth";
        // Post data parameters
        private static readonly string RegistrationIdParam = "registration_id";
        private static readonly string CollapseKeyParam = "collapse_key";
        private static readonly string DataPayloadParam = "data.payload";
        private static readonly string DelayWhileIdleParam = "delay_while_idle";
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var payload1 = new NotificationPayload("0755ac6c555e9b9e819b15772e6bcb11d64c659d531a28cf7674050a23fa846e", "Notice Updated, Please Check Notice Board Section !!!", 1, "default");
                p = new List<NotificationPayload> { payload1 };
                string cerPath = System.Configuration.ConfigurationManager.AppSettings["AppCertificate"].ToString();
                bool useSandbox = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["useSandbox"].ToString());
                string certPass = System.Configuration.ConfigurationManager.AppSettings["certPassword"].ToString();
                push = new PushNotification(useSandbox, Server.MapPath(cerPath), certPass);
                var rejected = push.SendToApple(p);
                System.Diagnostics.Debug.WriteLine(p);
                foreach (var item in rejected)
                {
                    Console.WriteLine(item);
                }
                Console.ReadLine();
            }
            catch(Exception ex)
            {
                lblenc.Text = ex.Message;
            }
        }
Posted
Updated 28-Dec-16 2:25am

1 solution

The error is pretty clear. It cannot find the dll it is referencing or that dll needs another dll to work and it isn't there. Make sure your dlls are in the bin folder or you can install them to the gac on the server.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900