How to communicate between Windows Services

萝らか妹 提交于 2019-12-04 06:41:06
jglouie

Sure. There are a bunch of IPC mechanisms you could use. Remoting, TCP/HTTP Listeners, etc.

Does either service provide functionality that might be useful outside of the other service?

See this thread for more ideas: IPC Mechanisms in C# - Usage and Best Practices

EDIT: As Davide Piras pointed out, if WCF is available for you to use, then consider using it. It will simplify life. The WCF configuration files are sometimes a pain to wield, but there's a nice tool for that too: http://msdn.microsoft.com/en-us/library/ms732009.aspx

Jesse C. Slicer

Are the services on the same box? Do you have .NET 4? Highly recommend using the fastest mode possible, memory-mapped files.

If they're on the same box, but you don't have .NET 4, or are in a homogenous Microsoft Windows network, named pipes could work. More to the point, I'd use WCF over a named pipe.

gigi

I found all the other answers correct but a little too much complicated (WCF is a big deal) and not scalable (memory and named pipes will only work on the same sever). I suggest you DotNetMQ messaging system. It's easy to use and deploy and let's you communicate even between processes running on different servers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!