I'm trying to migrate grpc server to the new package.
The app that hosts the grpc server runs on IIS Experess and uses the ASP.NET Core 3.1 framework.
In the old version, we built a server (from Grpc.Core) and defined the host and port (this port is different from the iis port):
// var grpcServer = new Server
// {
// Services =
// {
// },
// Ports = { new ServerPort("localhost", 50055, ServerCredentials.Insecure) },
// RequestCallTokensPerCompletionQueue = 32768
// };
// grpcServer.Start();
Now that server class is not available in Grpc.AspNetCore.Server
, we use services.AddGrpc
, but there's nowhere to define the port we need:
services.AddGrpc(options =>
{
options.EnableDetailedErrors = true;
});
and:
app.UseEndpoints(endpoints =>
{
endpoints.MapGrpcService<AppProtosImpl>().RequireHost($"http://localhost:50055");
});
My launchSettings.json
is :
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53590",
"sslPort": 44313
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Debug",
"APP_VERSION": ""
},
"ancmHostingModel": "OutOfProcess"
},
To sum up, I need that my app will listen to both ports: 50055 and 53590.
Does anybody know how to do it?
Thanks