SignalR - No connection could be made because the target machine actively refused it?
- by user2151460
Trying to create a Console application that is going to send data to a website. The website is built with Codeiginter framework, if that matters.
When i'm running my Console application, i get the error that a connection could not be made, and that the machine refused it.
Been watching some tutorials, but most of them are using Hubs etc, which imo i do not need for this simple task?. All i want to do is to send data to the website, one way.
Here is my Console application
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Client;
namespace signalrDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            var connection = new Connection("http://localhost:3000/servers/2");
            connection.Received += data => Console.WriteLine(data);
            connection.Start().ContinueWith(task =>
            {
                if (task.IsFaulted)
                {
                    Console.WriteLine("Failed to start: {0}", task.Exception.GetBaseException());
                }
                else
                {
                    Console.WriteLine("Success! Connected with client connection id {0}", connection.ConnectionId);
                }
            });
            Console.ReadLine();
        }
    }
}
And at my website, i have this code
    $(function () {
        var connection = $.connection('http://localhost/servers/2');
        connection.received(function (data) {
            $("message").append(data + '<br />');
        });
         connection.start().done();
    });
Thank you.