从ASP.NET C向iOS发送推送通知时出错 [英] Getting error while sending push notification to iOS from ASP.NET C#

查看:72
本文介绍了从ASP.NET C向iOS发送推送通知时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将错误视为无法加载文件或程序集NLog,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 5120e14c03d0593c'或其中一个依赖项。系统找不到指定的文件。我的代码如下:



我的尝试:



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:

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;
            }
        }

推荐答案

错误很明显。它无法找到它引用的dll或者dll需要另一个dll才能工作而且它不存在。确保您的dll位于bin文件夹中,或者您可以将它们安装到服务器上的gac中。
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.


这篇关于从ASP.NET C向iOS发送推送通知时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆