Rebus 和 RavenDB
Rebus and RavenDB
正如我在上一个问题 () 中提到的,我现在正在处理远程队列与以前的本地队列,并且我使用的是 Rebus 0.83。在这种情况下,我的 RavenDB 与我的 Rebus windows 服务位于不同的机器上。我一直收到 "System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8080" 的错误 我没有在我的代码中的任何地方使用本地主机,我检查了我的配置,它指向 RavenDB 的正确 url。我的配置是
Configure.With(new WindsorContainerAdapter(container))
.Logging(l => l.Serilog())
.Transport(t => t.UseMsmqAndGetInputQueueNameFromAppConfig())
.MessageOwnership(d => d.FromRebusConfigurationSection())
.Subscriptions(s => s.Use(new RavenDbSubscriptionStorage(store, "Subscriptions")))
.Sagas(s => s.Use(new RavenDbSagaPersister(store)))
.CreateBus().Start();
我知道我可以使用 Rebus 从机器访问 RavenDB,因为我尝试过一个简单的控制台应用程序。感谢任何帮助。
完整的错误堆栈跟踪在这里
15:17 [Warning] 10 User exception in Rebus 1 worker 1: Rebus.MessageHandleException: Could not handle message with ID 06729fcb-8a8f-4148-876a-8ed88c741cf728 ---> 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 127.0.0.1:8080
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at Raven.Client.Connection.HttpJsonRequest.ReadJsonInternal(Func`1 getResponse) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:line 340
at Raven.Client.Connection.HttpJsonRequest.ReadResponseJson() in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:line 237
at Raven.Client.Connection.ServerClient.DirectGet(String[] ids, String operationUrl, String[] includes, Boolean metadataOnly) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 1034
at Raven.Client.Connection.ServerClient.<>c__DisplayClass5e.<Get>b__5d(String u) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 991
at Raven.Client.Connection.ReplicationInformer.TryOperation[T](Func`2 operation, String operationUrl, Boolean avoidThrowing, T& result) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ReplicationInformer.cs:line 558
at Raven.Client.Connection.ReplicationInformer.ExecuteWithReplication[T](String method, String primaryUrl, Int32 currentRequest, Int32 currentReadStripingBase, Func`2 operation) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ReplicationInformer.cs:line 524
at Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func`2 operation) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 174
at Raven.Client.Connection.ServerClient.Get(String[] ids, String[] includes, Boolean metadataOnly) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 991
at Raven.Client.Document.DocumentSession.LoadInternal[T](String[] ids, String[] includes) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\DocumentSession.cs:line 313
at Raven.Client.Document.MultiLoaderWithInclude`1.Load(String id) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\MultiLoaderWithInclude.cs:line 90
at Rebus.RavenDb.RavenDbSagaPersister.Find[T](String sagaDataPropertyPath, Object fieldFromMessage) at Rebus.Bus.Dispatcher.<Dispatch>d__c`1.MoveNext()
原来这是由于用户权限。默认本地系统无法跨机器发送消息,显然也无法跨机器到达 raven
正如我在上一个问题 (
Configure.With(new WindsorContainerAdapter(container))
.Logging(l => l.Serilog())
.Transport(t => t.UseMsmqAndGetInputQueueNameFromAppConfig())
.MessageOwnership(d => d.FromRebusConfigurationSection())
.Subscriptions(s => s.Use(new RavenDbSubscriptionStorage(store, "Subscriptions")))
.Sagas(s => s.Use(new RavenDbSagaPersister(store)))
.CreateBus().Start();
我知道我可以使用 Rebus 从机器访问 RavenDB,因为我尝试过一个简单的控制台应用程序。感谢任何帮助。
完整的错误堆栈跟踪在这里
15:17 [Warning] 10 User exception in Rebus 1 worker 1: Rebus.MessageHandleException: Could not handle message with ID 06729fcb-8a8f-4148-876a-8ed88c741cf728 ---> 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 127.0.0.1:8080
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at Raven.Client.Connection.HttpJsonRequest.ReadJsonInternal(Func`1 getResponse) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:line 340
at Raven.Client.Connection.HttpJsonRequest.ReadResponseJson() in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:line 237
at Raven.Client.Connection.ServerClient.DirectGet(String[] ids, String operationUrl, String[] includes, Boolean metadataOnly) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 1034
at Raven.Client.Connection.ServerClient.<>c__DisplayClass5e.<Get>b__5d(String u) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 991
at Raven.Client.Connection.ReplicationInformer.TryOperation[T](Func`2 operation, String operationUrl, Boolean avoidThrowing, T& result) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ReplicationInformer.cs:line 558
at Raven.Client.Connection.ReplicationInformer.ExecuteWithReplication[T](String method, String primaryUrl, Int32 currentRequest, Int32 currentReadStripingBase, Func`2 operation) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ReplicationInformer.cs:line 524
at Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func`2 operation) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 174
at Raven.Client.Connection.ServerClient.Get(String[] ids, String[] includes, Boolean metadataOnly) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 991
at Raven.Client.Document.DocumentSession.LoadInternal[T](String[] ids, String[] includes) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\DocumentSession.cs:line 313
at Raven.Client.Document.MultiLoaderWithInclude`1.Load(String id) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\MultiLoaderWithInclude.cs:line 90
at Rebus.RavenDb.RavenDbSagaPersister.Find[T](String sagaDataPropertyPath, Object fieldFromMessage) at Rebus.Bus.Dispatcher.<Dispatch>d__c`1.MoveNext()
原来这是由于用户权限。默认本地系统无法跨机器发送消息,显然也无法跨机器到达 raven