An example of:
- Integrate IdentityServer4 with ASP.NET Core Identity
- Integrate Ocelot as ApiGateway (in term of Microservices) with Consul for service discovery
- Download Consul for Windows
- Unzip to the path, for example,
C:\Consul
. Then add this path to the PATH environment - Fire up Consul with the following command line
consul agent -dev
- Open browser with the link
http://localhost:8500
- Modify the connection string in
DncIds4.IdentityServer > appsettings.Development.json
- Configure solution to run multiple project
- Fire up by
Ctrl + F5
- Back to browser with the link
http://localhost:8500
to verify these services has been registered to Consul
1. Request a token
2. Register new account
- Endpoint:
http://localhost:5003/account/register
- Json body
{
"username": "kim.admin",
"emailAddress": "kim.admin@mail.com",
"password": "Kimadmin@123",
"isAdmin": true
}
1. Request a token
2. Get weather forecast information
- Endpoint:
http://localhost:5003/weather/forecast
- Use
IHostedService
to
- Do database migration by following the link - Running async tasks on app startup in ASP.NET Core 3.0
- Automatically register service to Consul by following the link - API Gateway using .NET Core, Ocelot and Consul