NServiceBus endpoints looking for RavenDB for timeouts after upgrading 3.0.3 -> 3.2.2

2.7k views Asked by At

Using NuGet I upgraded all the NServiceBus references in a project from 3.0.3 to 3.2.2 For the 4 services in this solution I also gave them references to NServiceBus.Host from NuGet

I deployed the binaries to a test environment, and the services now startup but then fail after some time with the error below. Is there some additional configuration required in 3.2?

Unhandled Exception: Magnum.StateMachine.StateMachineException: Exception occurr ed in Topshelf.Internal.ServiceController`1[[NServiceBus.Hosting.Windows.Windows Host, NServiceBus.Host, Version=3.2.0.0, Culture=neutral, PublicKeyToken=9fc3864 79f8a226c]] during state Initial while handling OnStart ---> System.Exception: E xception when starting endpoint, error has been logged. Reason: An exception was thrown while invoking the constructor 'Void .ctor(Raven.Client.IDocumentStore)' on type 'RavenTimeoutPersistence'. ---> Autofac.Core.DependencyResolutionExcept ion: An exception was thrown while invoking the constructor 'Void .ctor(Raven.Cl ient.IDocumentStore)' on type 'RavenTimeoutPersistence'. ---> System.Net.WebExce ption: Unable to connect to the remote server ---> System.Net.Sockets.SocketExce ption: No connection could be made because the target machine actively refused i t

2

There are 2 answers

2
Andreas Öhlund On BEST ANSWER

In 3.2 the TimeoutManager is on by default so you need to turn it off to avoid using Raven. Configure.DisableTimeoutManager()

0
Khan On

My instance is creating an error message I believe falls under the same question, but it creates the following message --

Message=No connection could be made because the target machine actively refused it 127.0.0.1:8080

I'm not sure why it is trying to connect to port 8080 in the local machine. Also, even though nothing is running on port 8080, why is it failing?

Do I have to have an instance of RavenDB running on port 8080 for this to work? Here is the actual exception that I am getting ...

System.Net.WebException was unhandled by user code
HResult=-2146233079 Message=Unable to connect to the remote server
Source=System StackTrace: at System.Net.HttpWebRequest.GetResponse() at Raven.Client.Connection.HttpJsonRequest.ReadStringInternal(Func1 getResponse) in c:\Builds\raven\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:line 301 at Raven.Client.Connection.HttpJsonRequest.ReadResponseString() in c:\Builds\raven\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:line 206 at Raven.Client.Connection.HttpJsonRequest.ExecuteRequest() in c:\Builds\raven\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:line 154 at Raven.Client.Connection.ServerClient.DirectPutIndex(String name, String operationUrl, Boolean overwrite, IndexDefinition definition) in c:\Builds\raven\Raven.Client.Lightweight\Connection\ServerClient.cs:line 629 at Raven.Client.Connection.ServerClient.<>c__DisplayClass34.<PutIndex>b__33(String operationUrl) in c:\Builds\raven\Raven.Client.Lightweight\Connection\ServerClient.cs:line 608 at Raven.Client.Connection.ServerClient.TryOperation[T](Func2 operation, String operationUrl, Boolean avoidThrowing, T& result) in c:\Builds\raven\Raven.Client.Lightweight\Connection\ServerClient.cs:line 204 at Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func2 operation) in c:\Builds\raven\Raven.Client.Lightweight\Connection\ServerClient.cs:line 168 at Raven.Client.Connection.ServerClient.PutIndex(String name, IndexDefinition definition, Boolean overwrite) in c:\Builds\raven\Raven.Client.Lightweight\Connection\ServerClient.cs:line 608 at Raven.Client.Connection.ServerClient.PutIndex[TDocument,TReduceResult](String name, IndexDefinitionBuilder2 indexDef, Boolean overwrite) in c:\Builds\raven\Raven.Client.Lightweight\Connection\ServerClient.cs:line 665 at NServiceBus.Timeout.Hosting.Windows.Persistence.RavenTimeoutPersistence..ctor(IDocumentStore store) in c:\TeamCity\buildAgent\work\nsb.master_8\src\timeout\NServiceBus.Timeout.Hosting.Windows\Persistence\RavenTimeoutPersistence.cs:line 22 InnerException: System.Net.Sockets.SocketException HResult=-2147467259 Message=No connection could be made because the target machine actively refused it 127.0.0.1:8080 Source=System ErrorCode=10061 NativeErrorCode=10061 StackTrace: 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, Exception& exception) InnerException:

UPDATE:

So after going through all the frustration, it seems that NServiceBus was trying to connect to the RavenDB using the port 8080. Because I had RavenDB installed already for some other projects, it seemed that "RuMeFirst.bat" figured it wouldn't use the NServiceBus provided db (maybe?) and instead wanted to use my previous install. Problem was, my original installation of RavenDB was running on port 8079 (I think that's the default for RavenDB). So when I would run NServiceBus with just a simple EndpointConfig class as a server, it wouldn't find anything on port 8080 and wouldn't want to run.

Moral of the story: Remove RavenDB before installing NServiceBus OR run RavenDB on port 8080 and then install NServiceBus to remove any of these errors that I got originally.