title: Configure separate port for grpc and rest API in .net Core API version 3.1
body: <p>Earlier we were using .net core 2.1 API, In the same Project we were exposing two ports, One for rest API and another one for GRPC</p>
  
  <p>Below is how our startup and Program file looks like </p>
  
  <p>Startup file</p>
  
  <pre><code>  public void Configure(IApplicationBuilder app, IHostingEnvironment env)
      {
          //Proces for GRPC server binding
          Server server = new Server
          {
              Services = { HealthCheck.BindService(new HealthCheckController()),
                           },
              Ports = { new ServerPort("0.0.0.0", 5001, ServerCredentials.Insecure) }
          };
          //Start GRPC server
          server.Start();
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
          else
          {
              app.UseHsts();
          }
  
          app.UseHttpsRedirection();
          app.UseMvc();
      }
  </code></pre>
  
  <p>Program file</p>
  
  <pre><code>public static class Program
  {
      public static void Main(string[] args)
      {
          CreateWebHostBuilder(args).Build().Run();
      }
  
      public static IWebHostBuilder CreateWebHostBuilder(string[] args)
      {
          return WebHost.CreateDefaultBuilder(args).UseStartup&lt;Startup&gt;();
      }
  }
  </code></pre>
  
  <p>Now we want to migrate the same project to .net core 3.1, and want to maintain two seprate ports, one for GRPC and other one for rest API</p>
  
  <p>Below is how our startup and Program file looks like </p>
  
  <p>Startup file</p>
  
  <pre><code>  public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
      {
  
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
  
          app.UseRouting();
  
          app.UseAuthorization();
  
          app.UseEndpoints(endpoints =&gt;
          {
              endpoints.MapGrpcService&lt;HealthCheckController&gt;();
              endpoints.MapControllers();
          });
          //Start GRPC server
  
      }
  </code></pre>
  
  <p>Program file</p>
  
  <pre><code>    public static class Program
  {
      public static void Main(string[] args)
      {
          CreateHostBuilder(args).Build().Run();
      }
  
  
      public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
          Host.CreateDefaultBuilder(args)
              .ConfigureWebHostDefaults(webBuilder =&gt;
              {
                  webBuilder.UseStartup&lt;Startup&gt;();
              });
  }
  </code></pre>
  
  <p>But the problem is after migrating to .net core 3.1 we are only able to use both the services on the same port, any help on how we can separate ports for GRPC and Rest API is appreciated. </p>