在Windows服务和IIS AKKA.NET actor系统之间发送消息时套接字连接失败

时间:2016-08-23 15:07:53

标签: akka.net

我们看到以下问题 - 我们有几个actor系统和actor实例 - 大多数是windows服务 - 并在它们之间交换消息 - 这通常是有效的。我们现在引入了一个链接到API的新actor,因此它位于IIS

这出于某种原因阻止在Windows服务actor实例和驻留在IIS中的远程actor之间传递消息 使用akka.net 1.1.1和helios 2.1.3

相同的actor代码和配置,当移动到另一个Windows服务时确实按预期运行

IIS应用程序正在运行,我可以看到netstat显示端口正在侦听,甚至可以调试代码,只要socket被绑定,但是在iis下我得到套接字异常

*2016-08-23 10:02:44.232 +01:00 [Warning] Tried to associate with unreachable remote address ["akka.tcp://NodeSystem@127.0.0.1:7096"]. Address is now gated for 5000 ms, all messages to this address will be delivered to dead letters. Reason: ["Invalid address: akka.tcp://NodeSystem@127.0.0.1:7096"] "Caused by: [Akka.Remote.Transport.InvalidAssociationException: Association failure ---> Helios.Exceptions.HeliosConnectionException: failed as a result of System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Helios.Channels.ConnectException: LogError connecting to 127.0.0.1:7096 ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at Helios.Channels.Sockets.SocketChannelAsyncOperation.Validate()
   at Helios.Channels.Sockets.TcpSocketChannel.DoFinishConnect(SocketChannelAsyncOperation operation)
   at Helios.Channels.Sockets.AbstractSocketChannel.AbstractSocketUnsafe.FinishConnect(SocketChannelAsyncOperation operation)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Helios.Channels.Bootstrap.ClientBootstrap.<DoResolveAndConnect>d__15.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Akka.Remote.Transport.Helios.HeliosTcpTransport.<>c.<AssociateInternal>b__1_0(Task`1 tr)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Helios.Channels.ConnectException: LogError connecting to 127.0.0.1:7096 ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at Helios.Channels.Sockets.SocketChannelAsyncOperation.Validate()
   at Helios.Channels.Sockets.TcpSocketChannel.DoFinishConnect(SocketChannelAsyncOperation operation)
   at Helios.Channels.Sockets.AbstractSocketChannel.AbstractSocketUnsafe.FinishConnect(SocketChannelAsyncOperation operation)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Helios.Channels.Bootstrap.ClientBootstrap.<DoResolveAndConnect>d__15.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Akka.Remote.Transport.Helios.HeliosTcpTransport.<>c.<AssociateInternal>b__1_0(Task`1 tr)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> Helios.Channels.ConnectException: LogError connecting to 127.0.0.1:7096 ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at Helios.Channels.Sockets.SocketChannelAsyncOperation.Validate()
   at Helios.Channels.Sockets.TcpSocketChannel.DoFinishConnect(SocketChannelAsyncOperation operation)
   at Helios.Channels.Sockets.AbstractSocketChannel.AbstractSocketUnsafe.FinishConnect(SocketChannelAsyncOperation operation)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Helios.Channels.Bootstrap.ClientBootstrap.<DoResolveAndConnect>d__15.MoveNext()
---> (Inner Exception #0) Helios.Channels.ConnectException: LogError connecting to 127.0.0.1:7096 ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at Helios.Channels.Sockets.SocketChannelAsyncOperation.Validate()
   at Helios.Channels.Sockets.TcpSocketChannel.DoFinishConnect(SocketChannelAsyncOperation operation)
   at Helios.Channels.Sockets.AbstractSocketChannel.AbstractSocketUnsafe.FinishConnect(SocketChannelAsyncOperation operation)
   --- End of inner exception stack trace ---<---
<---
<---
 ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Helios.Channels.ConnectException: LogError connecting to 127.0.0.1:7096 ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at Helios.Channels.Sockets.SocketChannelAsyncOperation.Validate()
   at Helios.Channels.Sockets.TcpSocketChannel.DoFinishConnect(SocketChannelAsyncOperation operation)
   at Helios.Channels.Sockets.AbstractSocketChannel.AbstractSocketUnsafe.FinishConnect(SocketChannelAsyncOperation operation)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Helios.Channels.Bootstrap.ClientBootstrap.<DoResolveAndConnect>d__15.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Akka.Remote.Transport.Helios.HeliosTcpTransport.<>c.<AssociateInternal>b__1_0(Task`1 tr)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at Akka.Remote.Transport.Helios.HeliosTcpTransport.<>c.<AssociateInternal>b__1_1(Task`1 r)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Akka.Remote.Transport.Helios.HeliosTransport.<Associate>d__27.MoveNext()
   --- End of inner exception stack trace ---]"
2016-08-23 10:02:44.233 +01:00 [Error] "Invalid address: akka.tcp://NodeSystem@127.0.0.1:7096"
Akka.Remote.InvalidAssociation: Invalid address: akka.tcp://NodeSystem@127.0.0.1:7096 ---> Akka.Remote.Transport.InvalidAssociationException: Association failure ---> Helios.Exceptions.HeliosConnectionException: failed as a result of System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Helios.Channels.ConnectException: LogError connecting to 127.0.0.1:7096 ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at Helios.Channels.Sockets.SocketChannelAsyncOperation.Validate()
   at Helios.Channels.Sockets.TcpSocketChannel.DoFinishConnect(SocketChannelAsyncOperation operation)
   at Helios.Channels.Sockets.AbstractSocketChannel.AbstractSocketUnsafe.FinishConnect(SocketChannelAsyncOperation operation)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Helios.Channels.Bootstrap.ClientBootstrap.<DoResolveAndConnect>d__15.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Akka.Remote.Transport.Helios.HeliosTcpTransport.<>c.<AssociateInternal>b__1_0(Task`1 tr)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Helios.Channels.ConnectException: LogError connecting to 127.0.0.1:7096 ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at Helios.Channels.Sockets.SocketChannelAsyncOperation.Validate()
   at Helios.Channels.Sockets.TcpSocketChannel.DoFinishConnect(SocketChannelAsyncOperation operation)
   at Helios.Channels.Sockets.AbstractSocketChannel.AbstractSocketUnsafe.FinishConnect(SocketChannelAsyncOperation operation)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Helios.Channels.Bootstrap.ClientBootstrap.<DoResolveAndConnect>d__15.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Akka.Remote.Transport.Helios.HeliosTcpTransport.<>c.<AssociateInternal>b__1_0(Task`1 tr)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> Helios.Channels.ConnectException: LogError connecting to 127.0.0.1:7096 ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at Helios.Channels.Sockets.SocketChannelAsyncOperation.Validate()
   at Helios.Channels.Sockets.TcpSocketChannel.DoFinishConnect(SocketChannelAsyncOperation operation)
   at Helios.Channels.Sockets.AbstractSocketChannel.AbstractSocketUnsafe.FinishConnect(SocketChannelAsyncOperation operation)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Helios.Channels.Bootstrap.ClientBootstrap.<DoResolveAndConnect>d__15.MoveNext()
---> (Inner Exception #0) Helios.Channels.ConnectException: LogError connecting to 127.0.0.1:7096 ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at Helios.Channels.Sockets.SocketChannelAsyncOperation.Validate()
   at Helios.Channels.Sockets.TcpSocketChannel.DoFinishConnect(SocketChannelAsyncOperation operation)
   at Helios.Channels.Sockets.AbstractSocketChannel.AbstractSocketUnsafe.FinishConnect(SocketChannelAsyncOperation operation)
   --- End of inner exception stack trace ---<---
<---
<---
 ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Helios.Channels.ConnectException: LogError connecting to 127.0.0.1:7096 ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
   at Helios.Channels.Sockets.SocketChannelAsyncOperation.Validate()
   at Helios.Channels.Sockets.TcpSocketChannel.DoFinishConnect(SocketChannelAsyncOperation operation)
   at Helios.Channels.Sockets.AbstractSocketChannel.AbstractSocketUnsafe.FinishConnect(SocketChannelAsyncOperation operation)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Helios.Channels.Bootstrap.ClientBootstrap.<DoResolveAndConnect>d__15.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Akka.Remote.Transport.Helios.HeliosTcpTransport.<>c.<AssociateInternal>b__1_0(Task`1 tr)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at Akka.Remote.Transport.Helios.HeliosTcpTransport.<>c.<AssociateInternal>b__1_1(Task`1 r)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Akka.Remote.Transport.Helios.HeliosTransport.<Associate>d__27.MoveNext()
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at Akka.Remote.EndpointWriter.PublishAndThrow(Exception reason, LogLevel level)
   at Akka.Remote.EndpointWriter.<Initializing>b__24_1(Failure failure)
   at lambda_method(Closure , Object , Action`1 , Action`1 , Action`1 )
   at Akka.Tools.MatchHandler.PartialHandlerArgumentsCapture`4.Handle(T value)
   at Akka.Actor.ReceiveActor.ExecutePartialMessageHandler(Object message, PartialAction`1 partialAction)
   at Akka.Actor.ReceiveActor.OnReceive(Object message)
   at Akka.Actor.UntypedActor.Receive(Object message)
   at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
   at Akka.Actor.ActorCell.ReceiveMessage(Object message)
   at Akka.Actor.ActorCell.Invoke(Envelope envelope)
--- End of stack trace from previous location where exception was thrown ---
   at Akka.Actor.ActorCell.HandleFailed(Failed f)
   at Akka.Actor.ActorCell.SysMsgInvokeAll(EarliestFirstSystemMessageList messages, Int32 currentState)*

这是派遣演员的hocon

akka {
            # here we are configuring log levels
            log-config-on-start = on
            stdout-loglevel = INFO
            loglevel = DEBUG
            loggers = ["Akka.Logger.Serilog.SerilogLogger, Akka.Logger.Serilog"]
             persistence
            {
             journal 
             {
              plugin = "akka.persistence.journal.sql-server"

                sql-server 
                {
                  # qualified type name of the SQL Server persistence journal actor
                  class = "Akka.Persistence.SqlServer.Journal.SqlServerJournal, Akka.Persistence.SqlServer"

                  # dispatcher used to drive journal actor
                  plugin-dispatcher = "akka.actor.default-dispatcher"

                  # connection string used for database access
                  connection-string = "Data Source=wcamm0q3pdbd1.gbcaydc.emea.bankofamerica.com,15001;Initial Catalog=BrokerDealer;User ID=BDLFUser;Password=dfnklgkdfkg"

                  # default SQL commands timeout
                  connection-timeout = 30s

                  # SQL server schema name to table corresponding with persistent journal
                  schema-name = dbo

                  # SQL server table corresponding with persistent journal
                  table-name = AKKAJournal

                  # should corresponding journal table be initialized automatically
                  auto-initialize = off

                  # timestamp provider used for generation of journal entries timestamps
                  timestamp-provider = "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"

                  # metadata table
                  metadata-table-name = AKKAMetadata
                }
             }
             snapshot-store 
             {
               plugin = "akka.persistence.snapshot-store.sql-server"

                sql-server 
                {

                    # qualified type name of the SQL Server persistence journal actor
                    class = "Akka.Persistence.SqlServer.Snapshot.SqlServerSnapshotStore, Akka.Persistence.SqlServer"

                    # dispatcher used to drive journal actor
                    plugin-dispatcher = "akka.actor.default-dispatcher"

                    # connection string used for database access
                    connection-string = "Data Source=wcamm0q3pdbd1.gbcaydc.emea.bankofamerica.com,15001;Initial Catalog=BrokerDealer;User ID=BDLFUser;Password=dfgdfgdfg"

                    # default SQL commands timeout
                    connection-timeout = 30s

                    # SQL server schema name to table corresponding with persistent journal
                    schema-name = dbo

                    # SQL server table corresponding with persistent journal
                    table-name = AKKASnapshot

                    # should corresponding journal table be initialized automatically
                    auto-initialize = off
                }
             }
          }
            # this config section will be referenced as akka.actor
            actor {
              provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
              debug {
                  receive = on
                  autoreceive = on
                  lifecycle = on
                  event-stream = on
                  unhandled = on
              }
              deployment {
              /CashFundingManagementView {
                router = smallest-mailbox-pool
                nr-of-instances = 1
                }
              }
            }
            # here we're configuring the Akka.Remote module
            remote {
              helios.tcp {
                  transport-class =
            "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
                  #applied-adapters = []
                  transport-protocol = tcp
                  port = 7095
                  hostname = "localhost"
              }
            log-remote-lifecycle-events = INFO           
          }

这是我们使用的目标演员路径

akka.tcp://NodeSystem@127.0.0.1:7096 /用户/ FundingManagementView

和目的地HOCON

 akka {
          loglevel = DEBUG
          log-config-on-start = on    
          loggers = ["Akka.Logger.Serilog.SerilogLogger, Akka.Logger.Serilog"]

          persistence {
        snapshot-store {

            # Path to the snapshot store plugin to be used
            plugin = "akka.persistence.snapshot-store.local"

            # Local filesystem snapshot store plugin.
            local {

                # Class name of the plugin.
                class = "Akka.Persistence.Snapshot.LocalSnapshotStore, Akka.Persistence"

                # Dispatcher for the plugin actor.
                plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"

                # Dispatcher for streaming snapshot IO.
                stream-dispatcher = "akka.persistence.dispatchers.default-stream-dispatcher"

                # Storage location of snapshot files.
                dir = "c:/logs"
            }
        }
    }

          actor {
            provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
            debug {
              receive = on
              autoreceive = on
              lifecycle = on
              event-stream = on
              unhandled = on
            }
            deployment 
            {
              /FundingManagementView
              {                
                router = smallest-mailbox-pool
                nr-of-instances = 1               
              }
              /RealtimeControllerService
              {                
                router = smallest-mailbox-pool
                nr-of-instances = 1               
              }
              /SignalRBridge
              {                
                router = smallest-mailbox-pool
                nr-of-instances = 1               
              }
            }   
          }

          remote {
              helios.tcp {
                  transport-class = "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
                  transport-protocol = tcp
                  port = 7096
                  hostname = 0.0.0.0 # listen on all interfaces
                  public-hostname = "localhost"
              }
          }
        }  

关于诊断的任何想法,我目前正在尝试通过关联工作流进行调试,但这需要时间......

这里的操作系统已被锁定,因此我想知道这是否是由某些权限问题引起的,但仍然想知道为什么它本身就能胜出。服务赢。服务而不是win.servie到IIS(Express)演员系统

非常感谢任何帮助。

更新

相同的代码/配置工作在我的同事的盒子上 - 听起来像我的盒子很有趣 - 我可以偶尔telnet到套接字,但更多时候,它停止听

0 个答案:

没有答案