0

I am trying to build a .net MAUI app with Nethereum to get a balance . but it does not work and it gives me the following error :

error occurred when trying to send rpc requests(s): eth_getbalance

the inner exception error :

hostname nor servname provided, or not known (mainnet.infura.io:80)

the code I'm using is :

try
    {
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

        var web3 = new Web3("https://mainnet.infura.io/v3/{My infura API key}");
        //web3.TransactionManager.UseLegacyAsDefault = true;
        var wei = await web3.Eth.GetBalance.SendRequestAsync("0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae");


    }
    catch (Exception ex)
    {
        await DisplayAlert("Error", ex.Message, "0k");
    }

However, when I created .Net Console application it works fine but not in MAUI or blazor .

user2596181
  • 103
  • 2
  • 8

0 Answers0