alexalok/dotAPNS

Messages can be pushed locally when running, but cannot be pushed successfully after being deployed to the server

FelixSun opened this issue · 6 comments

I don’t know where the problem is. I used pushsharp+p12 certificate to push before. I recently wanted to change to p8 certificate for push. I quoted dotapns. The local test is running well, and the push message is all normal. After deploying to the server, it cannot be pushed. News, I don’t know what went wrong, have you encountered similar problems? Hope to get your help, thank you very much!

Are you using Azure by any chance?

I am also facing the same issue, works fine locally, but when deployed on server notifications are not working. I am using azure server.

I am using azure server.

Please see https://stackoverflow.com/a/68913081 for a possible solution.

I am also facing same issue on my voip call api, on checking on local system it is working fine, and on deploying the code on server after publishing it, the request doesnt give any answer, on postman I am getting timeout issue after about 5 10 mins. below is the code I am using for my purpose, please help a solution on this....

 var path = "";
            try
            {
                //isProduction = GetConfigurationValue.IsProduction;

                ApplePush applePush = new ApplePush(ApplePushType.Voip);
                applePush.AddAlert("Call");
                applePush.AddBadge(0);
                applePush.AddSound("default");

                applePush.AddCustomProperty("token", token);
                applePush.AddCustomProperty("senderUsername", senderUserName);
                applePush.AddCustomProperty("senderUserImage", senderUserImage);
                applePush.AddCustomProperty("senderFirstname", senderFirstName);
                applePush.AddCustomProperty("isUserVerified", isUserVerified);
                applePush.AddCustomProperty("senderLastname", senderLastName);
                applePush.AddCustomProperty("channelname", channelName);
                applePush.AddCustomProperty("senderId", senderId);
                applePush.AddCustomProperty("isUserLockedByMe", IsUserLockedByMe);


                foreach (var dt in deviceIds)
                {
                    applePush.AddVoipToken(dt);
                }


                path = HttpContext.Current.Server.MapPath(GetConfigurationValue.CertificatePath);

   
                var options = new ApnsJwtOptions()
                {
                    BundleId = GetConfigurationValue.BundleId,
                    CertFilePath = path,
                    // use either CertContent or CertFilePath, not both
                    KeyId = GetConfigurationValue.APNKeyId,
                    TeamId = GetConfigurationValue.APNTeamId
                };

                var httpClient = new HttpClient(new Http2CustomHandler());
                var apns = ApnsClient.CreateUsingJwt(httpClient, options);                
                if (!isProduction)
                {
                    apns.UseSandbox();
                }

                var result = await apns.SendAsync(applePush);

                return result.IsSuccessful;
            }
            catch (Exception ex)
            {
                throw new Exception(path, ex);
            }

I am using azure server.

Please see https://stackoverflow.com/a/68913081 for a possible solution.

Thank you. this solution worked for azure server. But I am facing problems with plesk.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.