简体   繁体   中英

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

I have two ASP.Net core projects in the same solution. 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? 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?

在此处输入图片说明

  • Should these two projects expose internal APIs exclusively for talking to each other? (In such case how can these internal APIs stay internal and secure)
  • 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.
  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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM