LoginSignup
0
0

MagicOnion×Unityクライアントで、「RpcException: Status(StatusCode="Unavailable", Detail="failed to connect to all addresses...」が出た時の解決法

Posted at

環境

クライアント側

  • Unity: 2021.3.18f1
  • gRPC unityプラグイン: 2.47.0-dev202204190851
  • MagicOnion: Ver.5.1.8
  • MessagePack: v2.5.140

サーバー側

  • ASP.NET Core 6.0 (ここを参考)

エラー状況

MagicOnion公式Qiitaのブログを参考に簡単な足し算をUnityクライアントから呼び出す処理を行おうと、サーバーを起動→Unity上で「Play」を行ったところ、

RpcException: Status(StatusCode="Unavailable", Detail="failed to connect to all addresses...

のようなエラーがUnityコンソール上で出現。

解決方法

サーバー側のappsettings.jsonを以下のように変更

{
  "Kestrel": {
    "Endpoints": {
      "Http": {
        "Url": "http://localhost:7000"
      },
      "Https": {
        "Url": "https://localhost:7001"
      }
    }
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}

それにともないクライアント側のコードも変更

原因考察

クライアント側がC#コンソールアプリケーションのときには発生しなかった。そのためunityと通信周りのせいだと思うけど詳しい原因は不明。。。StackOverFlowを見る感じPythonクライアントでも似た問題が起こっているよう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0