Cross Application Communication (C#)

孤街醉人 提交于 2019-12-01 19:12:58

you could do WCF without web hosting and without IIS, those WCF services will be TcpIp and will work in your local network with no problems, in this way you don't have SOAP Serialization.

One approach you could also use ( and I did use in a former company where we had a multi server multi-tier distributed application ), is to make your Event Helper Object to simply queue messages to a MSMQ which will reside on a certain server, this method works very well because is not synchronous like SendMessage so your application works even if the listener application is not available and not running or simply busy.

Then you could have a windows Service running on that machine ( we used to call it LoggingManager ) which peeks the messages from the queue and created the log in the databases at his own speed and peace ;-)

I've come across this requirement before. The solution usually involves writing the "event" to a "queue" and having a dedicated service reading the queue and posting to the database. WCF supports MSMQ and is a good choice.

You are describing to me, what sounds a lot like a service bus architecture - without me knowing a terrible great deal about the subject. Or am I completely wrong? If not, take a look at producks such as NServiceBus (http://www.nservicebus.com/). Maybe that will help you?

Regards, Morten

I'd suggest using WCF. It can be easily configured to only accept requests from the local machine for security purposes, and is more conducive to friendly .NET code then something like SendMessage or using NamedPipes or Ports directly.

If you like SendMessage concept, take a look at our MsgConnect product, which offers the same approach for communications between processes running on the same or on different systems. MsgConnect is cross-platofrm and is not limited to .NET.

WCF can be an option as well, though MsgConnect's API is probably simpler and easier to manage (as you also get the source code and support).

I think you want a self-hosted WCF application. This is a great book on WCF and chapter four talks about self-hosting.

Just in addition to those other answers: Your "Event" Helper could be a custom tracing component you register in your various applications. Doing so you wouldn't have to directly reference a "Event" Helper target in your applications but just log your events to the configured trace output.

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