简体   繁体   English

同一解决方案中两个ASP.NET Core项目之间的通信

[英]Communication between two ASP.NET Core projects in the same solution

I have two ASP.Net core projects in the same solution. 我在同一解决方案中有两个ASP.Net核心项目。 Both of these will be deployed on the same server at different ports (since they serve different applications). 两者都将部署在同一服务器上的不同端口上(因为它们为不同的应用程序提供服务)。 What's the best way for these two API projects to communicate with each other? 这两个API项目相互通信的最佳方式是什么? For example, if an API is called on one of the projects and it wants to notify the other project, what's the best (fast and secure) option to do so? 例如,如果在一个项目上调用了API,并且它想通知另一个项目,那么最好的方法(快速,安全)是什么?

在此处输入图片说明

  • Should these two projects expose internal APIs exclusively for talking to each other? 这两个项目是否应该仅公开内部API以便彼此通信? (In such case how can these internal APIs stay internal and secure) (在这种情况下,这些内部API如何保持内部和安全性)
  • Use a message broker? 使用消息代理?
  • Some other option 其他选择

I usually use 2 types of communications. 我通常使用两种类型的通信。

  1. HTTP for sync, when I need an immediate answer from another service. 当需要其他服务的即时答复时,可使用HTTP进行同步。
  2. For async, mostly message broker. 对于异步,主要是消息代理。 To send a message and the other service(s) process that. 发送消息,其他服务进行处理。 There are more async solutions depend on your needs. 还有更多异步解决方案取决于您的需求。

Balazs 巴拉兹

暂无
暂无

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

相关问题 使用 ASP.Net Core WebApi 在两个微服务之间进行通信 - Communication Between two microservices using ASP.Net Core WebApi asp.net和asp.net核心项目是否有可能在同一解决方案中“发挥出色”? - Is it possible for asp.net and asp.net core projects to “play nice” in the same solution? 两个 ASP.NET 核心项目之间的依赖注入 - Dependency injection between two ASP.NET Core projects 在asp.net核心解决方案中的项目之间共享视图(.cshtml文件) - Share views (.cshtml files) between projects in asp.net core solution 在同一个解决方案中结合 ASP.NET 和 ASP.NET 核心 - Combine ASP.NET and ASP.NET core in the same solution 属于同一解决方案中不同项目的页面之间的 ASP.NET 重定向 - ASP.NET Redirection between pages belonging to different projects within same solution 在MVC ASP.NET中的解决方案中的两个不同应用程序项目的不同视图之间导航 - Navigating between different Views from two different Application Projects within a Solution in MVC ASP.NET ASP.NET应用程序与Windows应用程序之间的双向通信 - Two way communication between asp.net application and windows application 使用Telosys DSL模型为asp.net core razor页面生成代码(多项目解决方案) - Using Telosys DSL model to generate code for asp.net core razor pages (solution with multiple projects) ASP.NET Core解决方案是否可以包含具有不同目标框架的项目? - Is it possible to have an ASP.NET Core solution contain projects with different target frameworks?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM