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.