In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Today, I will talk to you about the operation of the ASP.NET Core micro-service framework Ocelot+Consul+IdentityServer4, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
First, background introduction
The popularity of API gateway stems from the rise of the interface between mobile applications and enterprises in recent years, which changes the original single PC client to PC client, various browsers, mobile phone and intelligent terminal and so on. At the same time, most of the systems do not run alone, and often involve the need to dock with other systems and share data. With the introduction of the concept of micro-service architecture, API gateway has become a standard component of micro-service architecture. With the rapid development of business, there are more and more mobile application services for mobile phones. In order to reduce the coupling between clients and services and save the development cost of back-end micro-services, it is urgent to establish an API gateway with high performance, high availability and reducing online risk.
1) the current situation: suppose you happen to be a back-end developer, and your boss just asks you to develop a website, which involves a lot of back-end micro-services, such as members, merchandise, recommendation services, and so on. So there is a question here, how can APP/Browser access these back-end services? If the business is relatively simple, you can assign a separate domain name (https://service.api.company.com)) to each business, but this approach will have several problems: each business will need logic such as authentication, current restriction and permission verification. If each business works on its own and builds its own wheels to implement it, it will be very painful and can be pulled out and put into a unified place to do it.
2) effective solution: a better way is to use an API gateway to implement an API gateway to take over all ingress traffic, similar to the role of Nginx, forwarding all user requests to the back-end server, but the gateway not only does simple forwarding, but also makes some expansion for the traffic. For example, authentication, current restriction, permission, circuit breaker, protocol conversion, error code unification, cache, log, monitoring, alarm, etc., so that the general logic is extracted and done uniformly by the gateway, and the business side can also focus more on the business logic. improve the efficiency of iteration. By introducing the API gateway, the client only needs to interact with the API gateway and does not have to communicate with the interfaces of each business party separately.
This sharing course Aben will take ASP .NET Core as an example on the basis of the last two courses. At present, it is hot to match ocelot+consul, which automatically completes service registration (Consul) and service discovery (ocelot reads services in Consul) by embedding ocelot and consul clients in the service. When a user accesses a url, the ocelot will forward the user request to the real service pulled from the Consul according to the route and authenticate through the unified identity authentication authorization center IdentityServer4.
II. Introduction to the project structure of ASP.NET Core micro-service framework Ocelot+Consul+IdentityServer4
Practical exercise of ASP.NET Core Micro Service Framework Ocelot+Consul+IdentityServer4
Introduction to registration and discovery of Consul services IV. Downstream micro-services access to Consulting through API V. Introduction to Ocelot Gateways VI. Flow chart of Ocelot gateway authentication and authorization
Introduction and Construction of Authentication and Authorization IdentityServer4
8. Ocelot gateway accesses the authentication and authorization center
IX. Registration and Discovery of Ocelot Gateway access Conusl Service
10. Ocelot gateway uniformly views multiple Swagger micro-service interface documents. Gateway has its own definition in hardware and its own interpretation in software architecture. It is the entrance to all requests. Requests are called to the gateway, processed and processed, and then returned to the client. This process is, of course, the core of the gateway and the core of Ocelot. We can authorize, verify and cache users. Authentication and many other concerns are implemented in the gateway! After reading the above, do you have any further understanding of the operation of the ASP.NET Core micro-service framework Ocelot+Consul+IdentityServer4? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.