ABP VNext 微服務搭建入門(5)-- 閘道器
阿新 • • 發佈:2020-12-21
閘道器
閘道器用於為應用程式提供單一入口點,而不是每個服務的不同地址。閘道器還用於速率限制,安全性,身份驗證,負載平衡和更多要求。
該專案使用Ocelot庫來構建API閘道器,分別有內部閘道器、後端應用程式閘道器、公共網站閘道器。
Ocelot配置
appsettings.json
"ReRoutes": [ { "DownstreamPathTemplate": "/api/identity/{everything}", "DownstreamScheme": "http", "DownstreamHostAndPorts": [ { "Host": "localhost", "Port": 63568 } ], "UpstreamPathTemplate": "/api/identity/{everything}", "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { "DownstreamPathTemplate": "/api/productManagement/{everything}", "DownstreamScheme": "http", "DownstreamHostAndPorts": [ { "Host": "localhost", "Port": 60244 } ], "UpstreamPathTemplate": "/api/productManagement/{everything}", "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] } ], "GlobalConfiguration": { "BaseUrl": "http://localhost:65115" }
module
app.UseOcelot().Wait();