| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 | using GrpcService1.Services;using Microsoft.OpenApi.Models;using Microsoft.Extensions.DependencyInjection;using Microsoft.AspNetCore.Server.Kestrel.Core;namespace GrpcService1{    public class Program    {        public static void Main(string[] args)        {            var builder = WebApplication.CreateBuilder(args);            builder.Services.AddGrpc().AddJsonTranscoding();            builder.Services.AddGrpcSwagger();            builder.Services.AddSwaggerGen(c =>            {                c.SwaggerDoc("v1",                    new OpenApiInfo { Title = "gRPC transcoding", Version = "v1" });                //var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location);                //var xmlPath = Path.Combine(basePath, $"{AppDomain.CurrentDomain.FriendlyName}.xml");//Controller xml                //c.IncludeXmlComments(xmlPath, true);                //c.IncludeGrpcXmlComments(xmlPath, true);                var filePath = Path.Combine(System.AppContext.BaseDirectory, "GrpcService1.xml");                c.IncludeXmlComments(filePath);                c.IncludeGrpcXmlComments(filePath, includeControllerXmlComments: true);            });            builder.WebHost.ConfigureKestrel(options =>            {                options.ListenAnyIP(5000, listenOptions =>                {                    listenOptions.Protocols = HttpProtocols.Http1AndHttp2;                });            });            var app = builder.Build();                       app.UseSwagger();            if (app.Environment.IsDevelopment())            {                app.UseSwaggerUI(c =>                {                    c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");                });            }            app.MapGrpcService<GreeterService>();            app.MapGet("/", () => "Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");            app.Run();        }    }}
 |