J'ai une application UWP Windows 10 destinée à fonctionner comme un client SignalR. J'ai eu ce travail avant, mais récemment commencé à obtenir cette erreur: Error HRESULT E_FAIL has been returned from a call to a COM component
. Je ne sais pas ce qui a changé, rien de bizarre dans le contrôle de la source. Il apparaît lorsque j'essaie de déclencher une tâche d'arrière-plan via un ApplicationTrigger
.UWP (Windows 10) Tâche d'arrière-plan - Erreur HRESULT E_FAIL a été renvoyé d'un appel à un composant COM (VS2017)
Voici le code dans mon App.xml:
private void SignalR()
{
_hubConnection = new HubConnection("http://localhost/hollerhub");
_hubConnection.Credentials = CredentialCache.DefaultCredentials;
_toast = _hubConnection.CreateHubProxy("toast");
_toast.On<string>("broadcastMessage", msg =>
{
var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
localSettings.Values["toastInfo"] = msg;
var appTrigger = new ApplicationTrigger();
appTrigger.RequestAsync().GetResults(); // <--- This is where the error is thrown
});
_hubConnection.Start();
}
La tâche de fond est inscrit au début de l'application, mais le ApplicationTrigger
ne parvient pas aux codes de ma tâche de fond avant d'échouer. Il reçoit le message SignalR très bien.