F# 正在删除非本地收件人的邮件[Akka.Actor.actorSelectMessage]

F# 正在删除非本地收件人的邮件[Akka.Actor.actorSelectMessage],f#,akka,akka.net,akka-remote-actor,F#,Akka,Akka.net,Akka Remote Actor,我想要两个演员交流。我在本地机器上有一个本地系统(客户端),在EC2上有一个远程参与者(服务器)。但是我无法从客户端系统向远程参与者发送消息 testClient.fs #if INTERACTIVE #time "on" #r "nuget: Akka.FSharp" #r "nuget: Akka.TestKit" #endif open System open Akka.Actor open Akka.Configurati

我想要两个演员交流。我在本地机器上有一个本地系统(客户端),在EC2上有一个远程参与者(服务器)。但是我无法从客户端系统向远程参与者发送消息

testClient.fs

#if INTERACTIVE
#time "on"
#r "nuget: Akka.FSharp" 
#r "nuget: Akka.TestKit" 
#endif

open System
open Akka.Actor
open Akka.Configuration
open Akka.FSharp
open System.Collections.Generic

let configuration = 
                    ConfigurationFactory.ParseString(
                        @"akka {
                            actor {
                                provider = ""Akka.Remote.RemoteActorRefProvider, Akka.Remote""
                            }
                            remote {
                             transport = ""akka.remote.netty.NettyRemoteTransport""
                             netty {
                               hostname = localhost
                               port = 0
                             }
                           }
                        }")

let system = ActorSystem.Create("System", configuration)

[<EntryPoint>]
let main args =               
    let remoteClient = system.ActorSelection(
                            "akka.tcp://RemoteSystem@A.B.C.D:2552/user/remoteActor")
    printfn "%A" remoteClient
    remoteClient <! "message from client"
    Console.ReadLine() |> ignore
    0
#如果是交互式的
#时间“开”
#r“nuget:Akka.FSharp”
#r“nuget:Akka.TestKit”
#恩迪夫
开放系统
打开阿克卡,演员
打开Akka.Configuration
打开Akka.FSharp
open System.Collections.Generic
让配置=
ConfigurationFactory.ParseString(
@“阿克卡{
演员{
provider=”“Akka.Remote.RemoteActorRefProvider,Akka.Remote“”
}
遥远的{
传输=“akka.remote.netty.nettyremoteransport”
内蒂{
主机名=本地主机
端口=0
}
}
}")
让system=ActorSystem.Create(“系统”,配置)
[]
让主参数=
让remoteClient=system.ActorSelection(
“阿卡。tcp://RemoteSystem@A.B.C.D:2552/用户/远程参与者)
printfn“%A”远程客户端
远程客户端忽略
0
testServer.fs

#if INTERACTIVE
#time "on"
#r "nuget: Akka.FSharp" 
#r "nuget: Akka.TestKit" 
#endif
open System
open Akka.Actor
open Akka.Configuration
open Akka.FSharp
open System.Collections.Generic

let helper msg = printfn "hello from server : %A" msg

let configuration = 
                    ConfigurationFactory.ParseString(
                        @"akka {
                            actor {
                                provider = ""Akka.Remote.RemoteActorRefProvider, Akka.Remote""
                            }
                            remote {
                             transport = ""akka.remote.netty.NettyRemoteTransport""
                             netty {
                               hostname = ""A.B.C.D""
                               port = 2552
                             }
                           }
                        }")

let remoteSystem = ActorSystem.Create("RemoteSystem", configuration)

let createActor (f : 'a -> unit) = actorOf f

[<EntryPoint>]
let main args =  
  let remoteActor = createActor helper |> spawn remoteSystem "remoteActor"
  Console.ReadLine() |> ignore
  0
#如果是交互式的
#时间“开”
#r“nuget:Akka.FSharp”
#r“nuget:Akka.TestKit”
#恩迪夫
开放系统
打开阿克卡,演员
打开Akka.Configuration
打开Akka.FSharp
open System.Collections.Generic
让helper msg=printfn“来自服务器的你好:%A”msg
让配置=
ConfigurationFactory.ParseString(
@“阿克卡{
演员{
provider=”“Akka.Remote.RemoteActorRefProvider,Akka.Remote“”
}
遥远的{
传输=“akka.remote.netty.nettyremoteransport”
内蒂{
主机名=“A.B.C.D”
端口=2552
}
}
}")
让remoteSystem=ActorSystem.Create(“remoteSystem”,配置)
让createActor(f:'a->unit)=actorOf f
[]
让主参数=
让remoteActor=createActor helper |>生成remoteSystem“remoteActor”
Console.ReadLine()|>忽略
0
首先,当我启动服务器和运行客户端时,客户端会依次查找远程参与者并发送消息。然后我在EC2上的服务器中得到以下错误

[信息][09/25/2020 19:20:07][线程0001][远程处理(akka://RemoteSystem)]开始远程处理 [信息][09/25/2020 19:20:08][线程0001][远程处理(akka://RemoteSystem)]远程处理开始;收听地址:[阿克卡。tcp://RemoteSystem@0.0.0.0:2552] [信息][09/25/2020 19:20:08][线程0001][远程处理(akka://RemoteSystem)]远程处理现在监听地址:[akka。tcp://RemoteSystem@0.0.0.0:2552] [akka://RemoteSystem/user/remoteActor#1987516675] [错误][09/25/2020 19:20:23][Thread 0007][akka。tcp://RemoteSystem@0.0.0.0:2552/system/endpointManager/reliableEndpointWriter akka.tcp%3A%2F%2FSystem%400.0.0.0%3A2552-1/endpointWriter]正在为非本地收件人[[akka]删除邮件[akka.Actor.ActorSelectMessage]。tcp://RemoteSystem@A.B.C.D:2552/][阿卡。tcp://RemoteSystem@A.B.C.D:2552]入站地址[akka。tcp://RemoteSystem@0.0.0.0:2552]

运行客户端sie时在客户端sie上的输出 [信息][9/25/2020 7:20:21 PM][线程0001][远程处理(akka://System)]开始远程处理 [信息][9/25/2020 7:20:22 PM][线程0001][远程处理(akka://System)]远程处理已启动;正在侦听地址:[akka。tcp://System@0.0.0.0:2552] [信息][9/25/2020 7:20:22 PM][线程0001][远程处理(akka://System)]远程处理现在监听地址:[akka。tcp://System@0.0.0.0:2552] ActorSelection[主播(akka。tcp://RemoteSystem@A.B.C.D:2552/),路径(/user/remoteActor)]

然后我搜索了很多关于这个错误的信息,并在服务器上的配置文件中尝试了以下选项 公共主机名=本地主机, 绑定主机名=“A1.B1.C1.D1”,其中“A1.B1.C1.D1”是EC2实例的私有IP地址, 绑定端口=2552


可能是什么错误?知道如何修复吗?谢谢我猜这是因为NAT的参与。你需要告诉Akka你的外部/内部主机名是什么:


如果涉及2个NAT级别,则可能需要一些额外的线索和错误。

我猜这是由于涉及NAT。您需要告诉Akka您的外部/内部主机名:

如果涉及2个NAT级别,则可能需要一些额外的线索和错误