我有一个UWP Windows 10应用程序,打算用作信号器客户端。我以前就有过这样的工作,但最近开始出现这样的错误:
Error HRESULT E_FAIL has been returned from a call to a COM component
ApplicationTrigger
.
这是我应用程序中的代码。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();
}
后台任务在应用程序启动时注册,但
应用程序触发器
在失败之前未达到我的后台任务代码。它正在接收信号器消息。