注释grpc demo

This commit is contained in:
YUN-PC5\user 2023-10-17 14:01:22 +08:00
parent 10b57594ac
commit e49d007908

View File

@ -175,13 +175,13 @@ app.MapControllers();
using (var serviceScope = app.Services.CreateScope())
{
var services = serviceScope.ServiceProvider;
// get the IpPolicyStore instance
var ipPolicyStore = services.GetRequiredService<IIpPolicyStore>();
// seed IP data from appsettings
ipPolicyStore.SeedAsync().GetAwaiter().GetResult();
var optionsAccessor = services.GetRequiredService<IOptions<IpRateLimitOptions>>();
var ipRateLimitPolicyService = services.GetRequiredService<IIpRateLimitPolicyService>();
var ipRateLimitPolicies = ipRateLimitPolicyService.Queryable()
@ -192,11 +192,11 @@ using (var serviceScope = app.Services.CreateScope())
pol.IpRules.AddRange(ipRateLimitPolicies.Adapt<List<IpRateLimitPolicy>>());
await ipPolicyStore.SetAsync(optionsAccessor.Value.IpPolicyPrefix, pol);
var greeterClient = services.GetRequiredService<Greeter.GreeterClient>();
var helloReply = await greeterClient.SayHelloAsync(new HelloRequest
{
Name = "gree"
});
// var greeterClient = services.GetRequiredService<Greeter.GreeterClient>();
// var helloReply = await greeterClient.SayHelloAsync(new HelloRequest
// {
// Name = "gree"
// });
// Console.WriteLine(helloReply);
}