This article is reprinted from the WeChat public account "UP Technology Control", the author is conan5566. Please contact the UP Technology Control public account for reprinting this article. Overview Ocelot is aimed at people running microservices/service-oriented architectures with .NET that need to have a unified entry point into their systems. In particular I wanted to easily integrate with IdentityServer references and bearer tokens. Ocelot is a bunch of middleware in a specific order. Ocelot manipulates an HttpRequest object into a state specified by its configuration until it reaches the request builder middleware where it creates an HttpRequestMessage object that is used to make a request to a downstream service. The middleware that makes the request is the last thing in the Ocelot pipeline. It does not call the next middleware. There is a piece of middleware that maps an HttpResponseMessage to an HttpResponse object and returns it to the client. Basically, it has a bunch of other functionality. Code Implementation 1. Create a new API client 1 2. Create a new API gateway test 3. Install Ocelot using nuget 4. Add ConfigureAppConfiguration to the Program file
5. Startup file configuration
6. Add the file ocelot.json to the gateway project
7. Run and test 2 projects Code address https://gitee.com/conanOpenSource_admin/Example/commit/b3b5a6b15a060b46c5ecd2ea31f0d36791cda18c |
<<: This year's 5G mobile phones must have these features!
>>: US operators confirm that only premium users can enjoy C-band 5G signals
If you haven't been to Brazil, you should go ...
ProfitServer is a Russian hosting company founded...
This article is reprinted from the WeChat public ...
According to a new study from GSMA, global 5G con...
Why is it called Wi-Fi 6? Each new Wi-Fi version ...
[51CTO.com original article] Recently, the enterp...
Germany's "Industry 4.0 R&D White Pa...
[51CTO.com original article] Under the night, the...
spinservers has sent us new promotional machines,...
Some time ago, I shared the news of 80VPS's n...
RhinoTech sent an email yesterday about its Augus...
Compared with cloud computing, edge computing foc...
[[181162]] At the arrival of the new year, China&...
At the Huawei Day0 Lighting Up the Future Summit ...
[51CTO.com original article] Speaking of text mes...