Sending notification from WCF in .NET Framework 4.8 is stuck

Abierto
#366 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
28/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
csharp, firebase

Línea de trabajo

Comienza con el método SendMessage y la llamada await FirebaseMessaging.DefaultInstance.SendAsync(messagingMessage) que se muestra en el issue. Compara los entornos de ejecución de la consola y WCF y, después, inspecciona la configuración del proxy y del firewall mencionada por el informante. Se considerará completado cuando se haya identificado la causa del bloqueo específico de WCF y se haya documentado la configuración necesaria o una corrección reproducible.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

needs-triage

I have a WCF (Windows Communication Foundation) server. Recently, I tried to update the sending of notifications from a basic https request to Firebase Admin SDK.

The code I'm using in console version works perfectly from my machine. On the other hand, the same code used from the WCF on the same machine remains blocked when sending.

Here's the method I use:

public static async Task<string> SendMessage(string deviceId, string message, string IdSem, string UrlResponseSEM,
    string Auth_Message = "", string auth_key = "", bool isAuthMessageDansNotif = true)
{
    string color = "#0072C6";
    bool hasErrors = false;
    List<string> logList = new List<string> { "[=FCM_SendMessage=]" };

    try
    {
        logList.Add($"[deviceId:{deviceId}] [message:{message}] [IdSem:{IdSem}] [Auth_Message:{Auth_Message}] [color:{color}]");
        logList.Add($"[isAuthMessageDansNotif:{isAuthMessageDansNotif}]");

        Message messagingMessage = null;
        if (isAuthMessageDansNotif)
        {
            messagingMessage = new Message
            {
                Token = deviceId,
                Data = new Dictionary<string, string>
                {
                    { "time", DateTime.Now.ToString() },
                    { "idsem", IdSem },
                    { "urlresponse", UrlResponseSEM },
                    { "message", message },
                    { "auth_message", Auth_Message },
                    { "auth_key", auth_key }
                }
            };
        }
        else
        {
            messagingMessage = new Message
            {
                Token = deviceId,
                Data = new Dictionary<string, string>
                {
                    { "time", DateTime.Now.ToString() },
                    { "idsem", IdSem },
                    { "urlresponse", UrlResponseSEM },
                    { "message", message }
                }
            };
        }

        string postData = JsonConvert.SerializeObject(messagingMessage);
        logList.Add($"[postData={postData}]");

        LogSeo.MyLog.Debug("FCM_SENDING_MESSAGE ...");

        var response = await FirebaseMessaging.DefaultInstance.SendAsync(messagingMessage).ConfigureAwait(false);
        LogSeo.MyLog.Debug("FCM_SENDING_MESSAGE OK");

        return response;
    }
    catch (Exception ex)
    {
        hasErrors = true;
        logList.Add($"ERROR > {ex.GetAllExceptions()} {ex.StackTrace}");
        return $"ERROR:{ex.Message}";
    }
    finally
    {
        logList.Add("[=FCM_SendMessage=]");
        string strLog = string.Join(Environment.NewLine, logList);
        if (hasErrors)
        {
            LogSeo.MyLog.Error(strLog);
        }
        else
        {
            LogSeo.MyLog.Debug(strLog);
        }
    }
}

The method remains blocked at the following line:

var response = await FirebaseMessaging.DefaultInstance.SendAsync(messagingMessage).ConfigureAwait(false);

Could you please tell me what could have caused the problem?

Note that I'm using a proxy and that there may also be a firewall on the machine. Are there any specific ports that need to be unblocked?

If so, how can this work from my executable?

Thanks in advance for your help, and have a nice day,

I tried to send a notification through FCM from my WCF.

Lenguaje dominante
C#
Estrellas
407
Forks
147
Merge medio
2 d 10 h
PR fusionados (30 d)
12

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de firebase/firebase-admin-dotnet

Todos los issues de firebase/firebase-admin-dotnet

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.