Connection refused

I am suddenly have a problem with an application I created that uses ServiceStack to host a service. I am calling it using a simple system.web request with JSON. Everything was great until today when I got back to the project and keep getting refused connections. I see that Visual Studio did an automatic update of ServiceStack on Friday. And just now I used the Nuget package manager and updated everything in the server host solution. I still get the connection refused. I just can’t think of anything that would have changed except for the update. And I had not applied that to the project when the problem started.

System.Net.WebException: Unable to connect to the remote server —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) — End of inner exception stack trace — at System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request) at System.Net.WebClient.UploadString(Uri address, String method, String data)

The metadata page displays fine…

I can’t tell what issue you’re running into, but the exception you’re getting is due to trying to connect to an instance running on when there isn’t anything listening on that port.

So I’d first investigate why there isn’t anything running on as you’re expecting, perhaps ?debug=requestinfo can help identify and StartUp Exceptions you have.

I fired it up at a different port and it is working. I am not sure how that port got locked up since I know of nothing that is running that be using it.

Thanks. I am new to ServiceStack. I like it a lot. It is like a can opener. Infinitely useful. I have a lot to learn. Understanding the really helpful built-in and highly configurable debugging is helpful. I got a chance to learn about this today since your post. Thanks.

1 Like