简体   繁体   English

如何将字符串从一个项目的应用程序域传递到另一个项目的应用程序域

[英]How can i communicate a string from app domain of one project to app domain of another

I have 2 projects - Project A and Project B such that Project A is referenced in Project B. 我有2个项目-项目A和项目B,这样在项目B中引用了项目A。

I want the App domain of A to send a string to the App domain of B by publishing/subscribing event. 我希望A的App域通过发布/订阅事件将字符串发送到B的App域。

I am clueless how to do that ? 我不知道该怎么做? I have referenced this blog [ https://blog.vcillusion.co.in/sending-events-through-application-domain-boundary/ ] but here both the app domains communicate within the same project. 我已经引用了此博客[ https://blog.vcillusion.co.in/sending-events-through-application-domain-boundary/ ],但此处两个应用程序域都在同一项目中进行通信。

Option 1 - I think the best way to do that is to create a Web Service on Project B and consume it on Project A. It can be a simple Rest API with the services you need to execute. 选项1-我认为最好的方法是在Project B上创建一个Web Service并在Project A上使用它。它可以是带有需要执行的服务的简单Rest API。

Option 2 - Sockets . 选项2- 插座 You can communicate the two projects with sockets, one acts as server and the other as client. 您可以使用套接字来通信两个项目,一个充当服务器,另一个充当客户端。

Option 3 - WebSockets. 选项3-WebSockets。 It is a bit more complicated than the other two but it provides a good way to make a real-time connection between two projects that don't even have to be hosted in the same server. 它比其他两个项目复杂一些,但是它提供了一种在两个项目之间建立实时连接的好方法,这些项目甚至不必托管在同一服务器上。

You could use ZeroMQ's Request-Reply. 您可以使用ZeroMQ的请求-答复。

server example: http://zguide.zeromq.org/cs:hwserver 服务器示例:http: //zguide.zeromq.org/cshwserver

client example: http://zguide.zeromq.org/cs:hwclient 客户示例:http: //zguide.zeromq.org/cs : hwclient

For one server - multiple clients, consider Publish-Subscribe structure. 对于一台服务器-多个客户端,请考虑发布-订阅结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将变量从一个应用程序域传递到另一个应用程序域 - How to pass a variable from one app domain to another 如何将HTML文本框值从一个域复制到另一个域的文本框? - How can I copy HTML textbox values from one domain to another domain's textboxes? 将远程对象从一个App Domain传递到另一进程 - Passing remote object from one App Domain across to another process 将程序集加载到新的应用程序域并与WCF通信 - Load assembly to new app domain and communicate with WCF 允许我是app域的新用户,如何使用app域运行构造函数 - Allow me being new to app domain, how can i run a constructor using app domain 如何在另一个应用程序域中设置静态布尔? - How do I set a static bool in another app domain? 我可以从C#向远程应用程序域中注入线程吗 - Can I inject a thread in a remote app domain from C# 如何从一个域中存在的队列从另一域MSMQ接收消息 - How do I receive message from a queue existing in one domain from another domain MSMQ 如何查询一个域的用户是否是另一个 AD 域中的组的成员? - How can I query if a user of one domain is a member of a group in another AD domain? 如何在多域服务中使用一个连接字符串? - How can i use one connection string in multi Domain Services?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM