I have prepared dotnet service using grpc "template" (dotnet new grpc) that does simple CRUD operations on PostgreSQL DB. Service and database are on linux. I want to host it on linux and connect with my client from windows. Both computers are inside the same network - I can ping PC1 from PC2.
I've found that I should add hosting settings to Startup.cs file, but in this template there are no Startup.cs file. I have only Program.cs:
//Program.cs
using client_pgsql;
using client_pgsql.Services;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddGrpc();
builder.Services.AddDbContext<MovieContextClass>(
o=>o.UseNpgsql(builder.Configuration.GetConnectionString("MoviesDB"))
);
var app = builder.Build();
// Configure the HTTP request pipeline.
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");
// Configure the HTTP request pipeline.
app.MapGrpcService<MovieService>();
app.MapGet("/movie/", () => "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();
Could someone tell me what should I do to make this service accessible from another PC? And how to prepare client for this connection.