Sending notification from WCF in .NET Framework 4.8 is stuck

Aperta
#366 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
28/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
csharp, firebase

Direzione di ricerca

Inizia con il metodo SendMessage e la chiamata await FirebaseMessaging.DefaultInstance.SendAsync(messagingMessage) mostrata nell'issue. Confronta gli ambienti di esecuzione della console e di WCF, quindi analizza la configurazione del proxy e del firewall menzionata dal segnalatore. Il lavoro sarà considerato completato quando sarà stata identificata la causa del blocco specifico di WCF e sarà stata documentata la configurazione necessaria o una correzione riproducibile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C#
Stelle
408
Fork
147
Merge medio
1g 3h
PR unite (30g)
10

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di firebase/firebase-admin-dotnet

Tutte le issue di firebase/firebase-admin-dotnet

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.