从Asp.net发送消息给Window Service? [英] Send a message to Window Service From Asp.net ?

查看:68
本文介绍了从Asp.net发送消息给Window Service?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个运行窗口服务的场景。每当我的asp.net网站发生特定异常时,我都会调用窗口服务或从asp.net web向我的窗口服务发送消息,窗口服务会在收到该消息时生成一封电子邮件。什么是这种情况下最好的最佳解决方案。我应该使用某种wcf服务或共享数据库。请指导我这方面。

Hi,
I have a scenario where I have a window service running. Whenever, a specific exception occurs in my asp.net web, I call window service or send a message to my window service from asp.net web and window service generates an email on receiving that message. What would be the best best solution for this scenario. Should I use some kind of wcf service or shared database. Please guide me in this regard.

推荐答案

正如你看到的替代方案正确,我们对你的系统没有洞察力,你必须做出决定。 />
您可以使用任何可以满足您需求的IPC,但选择成本较低的解决方案,并解决最多的问题。当反应需要准时时,直接IPC是最好的,而当您不需要快速处理时,间接IPC(如共享文件或通用数据库)更好,但队列很好。我通常在这种邮件发送方案中实现基于表的队列。它很容易实现。虽然,我已经开发了一个简单的基于MSMQ的解决方案,具有相同的目的。你可以在这里看到它:在邮件中继中使用MSMQ [ ^ ]。
As you see the alternatives right, and we don''t have insight in your system, you have to decide.
You can use anything as IPC that suites your needs, but choose the one that costs the less, and solves the most. Direct IPC is best when the reaction needs to be on time, while indirect IPC (like shared files or common database) is better when you don''t need quick handling, but a queue is good to have. I am usually implementing table based queue in such mail-sending scenarios. It is easy to implement. Though, I have developed a simple MSMQ based solution with the same purpose. You can see it here: Using MSMQ in mail relay[^].


您可以使用NLog将日志保存在文本文件和SQL Server数据库中。接下来,您可以使用Windows服务读取最后的条目并使用电子邮件服务器发送。
You can use NLog, to save logs in text files and sql server databases. Next you can use windows service to read this last entries and send it using email server.


这篇关于从Asp.net发送消息给Window Service?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆