You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following is my code:
public async Task SendPushNotification(string deviceToken, Notification notification, object data)
{
var serverKey = _configuration["FCMServerKey"];
bool sent = false;
if (!String.IsNullOrEmpty(deviceToken))
{
using (var sender = new Sender(serverKey))
{
var message = new Message
{
To = deviceToken,
Priority = Priority.High,
ContentAvailable = true,
Notification = notification,
Data = data
};
var result = await sender.SendAsync(message);
Console.WriteLine($"Success: {result.MessageResponse.Success}");
sent = result.MessageResponse.Success == 1;
}
}
return sent;
}
And I got this error:
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application) 2018-12-10 15:12:17.6160|Default|0HLIUDJT5GOSP:00000007||Microsoft.AspNetCore.Server.Kestrel|ERROR|Connection id "0HLIUDJT5GOSP", Request id "0HLIUDJT5GOSP:00000007": An unhandled exception was thrown by the application. System.OperationCanceledException: The operation was canceled. at System.Net.Http.HttpClient.HandleFinishSendAsyncError(Exception e, CancellationTokenSource cts) at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at FCM.Net.Sender.SendAsync(HttpContent content)
at FCM.Net.Sender.SendAsync(Message message)
at Nova.Api.Tools.FCMPushNotification.SendPushNotification(String deviceToken, Notification notification, Object data) in E:\NovaGitProjects\Nurish\Nurish\SourceCode\Server\src\Nova.Pms.Modules\Nova.Api\Tools\FCM\FCMPushNotification.cs:line 81
at Nova.Api.Controllers.PlanController.RespondActivity(RespondRequestDto request) in E:\NovaGitProjects\Nurish\Nurish\SourceCode\Server\src\Nova.Pms.Modules\Nova.Api\Controllers\PlanController.cs:line 281
The text was updated successfully, but these errors were encountered:
Following is my code:
public async Task SendPushNotification(string deviceToken, Notification notification, object data)
{
var serverKey = _configuration["FCMServerKey"];
And I got this error:
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication
1 application) 2018-12-10 15:12:17.6160|Default|0HLIUDJT5GOSP:00000007||Microsoft.AspNetCore.Server.Kestrel|ERROR|Connection id "0HLIUDJT5GOSP", Request id "0HLIUDJT5GOSP:00000007": An unhandled exception was thrown by the application. System.OperationCanceledException: The operation was canceled. at System.Net.Http.HttpClient.HandleFinishSendAsyncError(Exception e, CancellationTokenSource cts) at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task
1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)at FCM.Net.Sender.SendAsync(HttpContent content)
at FCM.Net.Sender.SendAsync(Message message)
at Nova.Api.Tools.FCMPushNotification.SendPushNotification(String deviceToken, Notification notification, Object data) in E:\NovaGitProjects\Nurish\Nurish\SourceCode\Server\src\Nova.Pms.Modules\Nova.Api\Tools\FCM\FCMPushNotification.cs:line 81
at Nova.Api.Controllers.PlanController.RespondActivity(RespondRequestDto request) in E:\NovaGitProjects\Nurish\Nurish\SourceCode\Server\src\Nova.Pms.Modules\Nova.Api\Controllers\PlanController.cs:line 281
The text was updated successfully, but these errors were encountered: