c# - 尝试从 winforms 应用程序连接 GRPC 服务器时无法连接到所有地址异常
问题描述
你好grpc新手在这里,
我有一个要连接到 grpc 服务器的 winforms 应用程序。
我在 localhost 上运行 grpc 服务器并使用 winforms 应用程序连接到它没有问题。
我已经将我的 grpc 服务器部署到了一个临时 url:http ://mujf94-001-site1.gtempurl.com/
但是当我尝试连接它时,我收到以下错误:
Status(StatusCode="Unavailable", Detail="failed to connect to all addresses",
DebugException="Grpc.Core.Internal.CoreErrorDetailException:
{"created":"@1630271164.373000000","description":"Failed to pick
subchannel","file":"..\..\..\src\core\ext\filters\client_channel\client_channel.cc",
"file_line":3009,"referenced_errors":[{"created":"@1630271164.373000000","description":
"failed to connect to all addresses","file":"..\..\..\src\core\ext\filters\client_channel\
lb_policy\pick_first\pick_first.cc","file_line":398,"grpc_status":14}]}")
这就是我尝试连接到 grpc 服务器的方式:
var ip = "mujf94-001-site1.gtempurl.com".ToIPAddress();
var channel = new Channel(ip.ToString(),80, ChannelCredentials.Insecure);
//var channel = new Channel("http://mujf94-001-site1.gtempurl.com", 80, ChannelCredentials.Insecure);
Client = channel.CreateGrpcService<T>();
我的 grpc 服务器选项是这样的:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
webBuilder.ConfigureKestrel(options =>
{
options.Listen("mujf94-001-site1.gtempurl.com".ToIPAddress(), 80, o => o.Protocols = HttpProtocols.Http2);
});
webBuilder.UseStartup<Startup>();
});
我对此很陌生,所以非常感谢任何帮助
解决方案
推荐阅读
- python - 如何将石墨烯解析方法移动到不同的文件?
- elasticsearch - Centos 7 和 - java.lang.NoClassDefFoundError: 无法初始化类 com.sun.jna.Native
- reactjs - 如何在反应中参考本地文件夹中的照片?
- django - Django 管理员高级搜索
- amazon-web-services - AWS 子网 NACL 中的冲突规则
- raspberry-pi3 - Raspberry Pi3B+ 上的 Nordlynx 和 Buster
- python - 如何根据作为字母数字值的特定值对包含多个字典的列表进行排序
- f# - 在 F# 中获取目录大小的惯用方法
- javascript - axios - 从 API 调用加载数据时的 [Object Promise]
- javascript - 用分号换行符将csv文件拆分为javascript(节点)中的二维数组