大消息 Sender.Forward 133KB

large message Sender.Forward 133KB

我正在尝试发送一个 txt 文件(大小 133 kB)

public class HelloActor : UntypedActor
{
    public HelloActor()
    {
    }

    protected override void OnReceive(object request)
    {
        var data = System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory+"myfile.txt");
        Sender.Forward(data);
    }
}

这是我的客户端代码

var actor = System.ActorSelection("HelloActor");
return await actor.Ask<string>(null, TimeSpan.FromHours(1));

这不起作用。

您的问题与 maximum-frame-size 无关,因为您的 actor 行为可能根本没有被调用。假设您使用系统的 ActorOf 创建了您的 actor 并将其命名为 HelloActor,您的代码中有两件事是无效的:

  1. 不允许发送 null 作为消息。而是指定一些特定的值。这个错误实际上打印在错误日志中。
  2. 您选择的演员使用了无效路径。对于用户 space 中的顶级演员,它将是 /user/HelloActor。您会在日志中找到它,因为消息不会到达收件人,而是被推入死信。您可以阅读有关演员路径的更多信息 here.