且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

关于推送通知

更新时间:2023-02-16 21:45:38

你好Likesh,



从文档中可以看出这个库很清楚不适合在ASP.NET中使用。作者建议创建一个服务并从中使用该库。如果你必须在ASP.NET中使用这个库,那么他建议需要在 Global.asax &中创建PushBroker作为 Singleton 。在 Application_End 中,您必须调用 StopAllServices 。另一个建议是要发送的消息需要保存在某些数据存储中,并从OnNotificationSent事件中删除。这将减少由于无法预料的应用程序池终止或重新启动而丢失的消息。



希望这可以帮助您解决问题。



问候,
Hello Likesh,

From the documentation it's very clear that this library is not best suitable for use in ASP.NET. The author is suggesting to create a service and use this library from it. If you must use this library in ASP.NET then he is suggesting that PushBroker needs to get created as Singleton in Global.asax & in Application_End you must call StopAllServices. Another recommendation is that the messages to be sent needs to be persisted in some data store and be removed from from the OnNotificationSent event. This will mitigate losing messages due to unforeseen App Pool terminations or restarts.

Hope this helps you solve your problem.

Regards,