-1

I am trying to upload a file to Ipfs below is my code sample.

using (var ipfs = new IpfsClient())
                {
                    await ipfs.Swarm.Peers();
                    IpfsStream inputStream = new IpfsStream(filepath, System.IO.File.OpenRead(filepath));
                    MerkleNode node = await ipfs.Add(inputStream);
                    return Ok(node.Hash);
                }

and i am getting error System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. ---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it. at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)

Any reasons my firewall is turned off so that cant be an issue. Any suggestions.

Is it correct approach to write file on ipfs.

1 Answers1

0

The exception is giving you the answer. The remote server is denying the connection. Either the connection configuration is wrong at your end, or there's a mechanism at the service end that will only allow an incoming connection from certain places. Check both.

Jeff Putz
  • 14,504
  • 11
  • 41
  • 52