'Cassandra virtualbox error no connection could be made because the target machine actively refused it

I have cassandra install on the virtualbox and connect to c# application with the address, datacenter name correctly but still get the error. Is there anything that I miss and neede to be checked? enter image description here

    public ISession session;
    private string IP = "127.0.0.1";
    private string Datacenter = "datacenter1";
    public ISession getConnect()
    {
        return session = Cluster.Builder()
                             .AddContactPoints(IP)
                             .WithPort(9042)
                             .WithLoadBalancingPolicy(new DCAwareRoundRobinPolicy(Datacenter))
                             .Build()
                             .Connect();
    }


Solution 1:[1]

Check in virtualbox where Cassandra is listening: netstat -tlnp | grep 9042

try establish a connection using telnet: telnet <ip-addr> 9042

more detail here: https://community.datastax.com/questions/9242/native-transport-port-open-or-not.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Adelino Silva