Unknown error when creating connection with AppService UWP

Jonathan Aguilar Navarro 21 Reputation points
2022-06-15T22:22:11.94+00:00

I have the following c# code that creates a connection between my main app and a uwp app that performs a number of functions

using (var connection = new AppServiceConnection())  
            {  
                //Set up a new app service connection  
                connection.AppServiceName = "NombreAppService";  
                connection.PackageFamilyName = "NombreFamilia_xxxxxxxxxxx";  
                AppServiceConnectionStatus status = await connection.OpenAsync();  
  
                V_Resultado.OperacionCompleta = false;  
                V_Resultado.HuboError = true;  
                switch (status)  
                {  
                    case AppServiceConnectionStatus.Success:  
                        //await MostrarMensaje("Connection established", "Dato", MessageBoxButton.Aceptar);  
                        V_Resultado.OperacionCompleta = true;  
                        V_Resultado.HuboError = false;  
                        break;  
                    case AppServiceConnectionStatus.AppNotInstalled:  
                        V_Resultado.MensajeUsuario = "La aplicación AppServicesProvider no está instalada. Implemente AppServicesProvider en este dispositivo y vuelva a intentarlo.";  
                        return V_Resultado;  
                    case AppServiceConnectionStatus.AppUnavailable:  
                        V_Resultado.MensajeUsuario = "La aplicación AppServicesProvider no está disponible. Esto podría deberse a que se está actualizando actualmente o se instaló en un dispositivo extraíble que ya no está disponible.";  
                        return V_Resultado;  
                    case AppServiceConnectionStatus.AppServiceUnavailable:  
                        V_Resultado.MensajeUsuario = $"La aplicación AppServicesProvider está instalada pero no proporciona el servicio de la aplicación {connection.AppServiceName}.";  
                        return V_Resultado;  
                    default:  
                    case AppServiceConnectionStatus.Unknown:  
                        V_Resultado.MensajeUsuario = "Se produjo un error desconocido mientras intentábamos abrir una AppServiceConnection.";  
                        return V_Resultado;  
                }  

But sometimes when trying to make the connection the state that returns me is Unknown, and I can't find the reason.

I would greatly appreciate the help you can give me.

Thank you

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Dave Patrick 425.7K Reputation points MVP
    2022-06-15T22:23:48.03+00:00

    Q&A forums are currently English only. I'd try asking for help over here in dedicated forums.
    https://social.msdn.microsoft.com/Forums/es-es/home
    https://social.technet.microsoft.com/Forums/es-es/home
    https://answers.microsoft.com/es-es

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments

0 additional answers

Sort by: Most helpful