【发布时间】:2019-12-07 23:25:04
【问题描述】:
我有一个 ASP.NET Core 应用程序,它有两个端点。一个是MVC,另一个是Grpc。我需要红隼在不同的套接字上发布每个端点。示例:localhost:8888 (MVC) 和 localhost:8889 (Grpc)。
我知道如何在 Kestrel 上发布两个端点。但问题是它在两个端点上发布 MVC 和 gRPC,我不希望这样。这是因为我需要 Grpc 请求使用 Http2。另一方面,我需要 MVC 请求使用 Http1
在我的 Statup.cs 上
public void Configure(IApplicationBuilder app)
{
// ....
app.UseEndpoints(endpoints =>
{
endpoints.MapGrpcService<ComunicacaoService>();
endpoints.MapControllerRoute("default",
"{controller}/{action=Index}/{id?}");
});
// ...
我需要一种方法让endpoints.MapGrpcService<ComunicacaoService>(); 在一个套接字上发布,endpoints.MapControllerRoute("default","{controller}/{action=Index}/{id?}"); 在另一个套接字上发布。
【问题讨论】:
标签: c# asp.net-mvc grpc endpoint kestrel-http-server