# Connecting to mainnet via C# gRPC Client

**URL:** <https://forum.flow.com/t/connecting-to-mainnet-via-c-grpc-client/2394>\
**Category:** Node Operation\
**Created:** [September 16, 2021, 12:47am UTC](https://forum.flow.com/t/connecting-to-mainnet-via-c-grpc-client/2394 "2021-09-16T00:47:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sawru](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@sawru](https://forum.flow.com/u/sawru)\
**Post date:** [September 16, 2021, 12:47am UTC](https://forum.flow.com/t/connecting-to-mainnet-via-c-grpc-client/2394/1 "2021-09-16T00:47:34Z")

</div>

Hello,

I’m receiving an error when attempting to connect to the mainnet via gRPC calls.  
This is simply my code. I’ve created a .proto file with only the Ping methods and Messages.

```auto
string url = "https://access.mainnet.nodes.onflow.org:9000";

Channel channel = new Channel(url, ChannelCredentials.Insecure);
var client = new AccessAPI.AccessAPIClient(channel);

PingResponse var = client.Ping(new PingRequest());
Console.WriteLine(var);

```

I’m receiving the following error:

```auto
Grpc.Core.RpcException: 'Status(StatusCode="Unavailable", Detail="DNS resolution failed for service: https://access.mainnet.nodes.onflow.org:9000", 

```

Looking for some help on connecting a C# gRPC client to any of the mainnets. Thanks!

---

<div class="post-metadata">

**Author:** ![sawru](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@sawru](https://forum.flow.com/u/sawru)\
**Post date:** [September 20, 2021, 7:57pm UTC](https://forum.flow.com/t/connecting-to-mainnet-via-c-grpc-client/2394/2 "2021-09-20T19:57:16Z")

</div>

Got it.

```auto
// Main API Source
            string uri = "access.mainnet.nodes.onflow.org:9000";

            Channel channel = new Channel(uri, ChannelCredentials.Insecure);
            var client = new AccessAPI.AccessAPIClient(channel);

            // Get Block Info
            BlockResponse reply = client.GetLatestBlock(new GetLatestBlockRequest { IsSealed=true });
            Block latestBlock = reply.Block;

```
