0

我通过调用一个简单的 nethereum 方法(如下所示)向 infura 发送请求,但出现超时错误。

这是我的要求

System.Net.ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
var publicKey = "0x...";
var web3 = new Web3("https://mainnet.infura.io");
Console.WriteLine(web3);

var balance = await web3.Eth.GetBalance.SendRequestAsync(publicKey);
var etherAmount = Web3.Convert.FromWei(balance.Value);
       
Console.WriteLine("Get txCount " + etherAmount);
Console.ReadLine();

我在这一行收到 Rpc 超时错误

var balance = await web3.Eth.GetBalance.SendRequestAsync(publicKey);

这是我的输出

[TaskCanceledException: A task was canceled.]
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +173
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64
Nethereum.JsonRpc.Client.<SendAsync>d__19.MoveNext() +539

[RpcClientTimeoutException: Rpc timeout after 20000 milliseconds]
Nethereum.JsonRpc.Client.<SendAsync>d__19.MoveNext() +1072

你能帮我解决这个问题吗?谢谢

4

0 回答 0