Click here to Skip to main content
11,934,809 members (44,306 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET Windows Win2008-R2 , +

I am trying to execute a NUnit test case (.Net 4.0 .dll, compiled against NUnit 2.5.9 ) using NUnit console in Windows 2008 R2 (X64) but it fails with below error message. Any idea?

System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
Server stack trace:
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
   at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)
   at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
   at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
   at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
   at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
   at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at NUnit.Core.TestRunner.get_Running()
   at NUnit.Core.ProxyTestRunner.get_Running()
   at NUnit.Util.TestLoader.get_Running()
   at NUnit.Gui.NUnitForm.get_IsTestRunning()
   at NUnit.Gui.NUnitForm.NUnitForm_Closing(Object sender, CancelEventArgs e)
   at System.Windows.Forms.Form.OnClosing(CancelEventArgs e)
   at System.Windows.Forms.Form.WmClose(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Posted 18-Mar-11 5:57am
Edited 18-Mar-11 8:39am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Erhm, are you sure your firewall is switched off, or that you've created a rule in your firewall allowing communication over the given port 61137?
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Hi Eduard,

Thanks for your response.

Port number is changing all the time. Now it's 61137 and last time it was some thing else.
I am executing the DLL manually using NUnit in a single box..should I be checking the firewall even if the DLL is not calling any external services?

Eduard Keilholz 18-Mar-11 12:26pm
I do think so, just try to switch it off for a brief moment. If your code works, you know the firewall is in your way, else you have to find the problem somewhere else.
Richard MacCutchan 18-Mar-11 13:41pm
I don't think the firewall looks at messages on the loopback address.
Richard MacCutchan 18-Mar-11 13:42pm
Are you sure you have a listener on this address?
Member 4545580 18-Mar-11 14:13pm
ping doesn't work
but works fine.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

I don't know if this is possible, but I got this same error from NUnit when I actually had an infinite loop going in one of my tests.

I had some overloaded assert method that ended up looping back on itself. When I ran the code using the TestDriven.Net tool I saw the stack overflow exception that was causing Nunit to hang, and eventually return the error you mentioned.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 22 Apr 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100