我在一个非常简单的客户端服务器配置中使用Akka.Net。目前没什么先进的。在来回发送消息约3或4天后,似乎整个系统都处于断开连接状态。重启服务后,一切都重新连接,没有问题。在此之前,事情将会断开,但它似乎立即重新连接。
在此期间,两台计算机都可以在网络上访问,并且似乎没有任何实际的连接问题。
我不知道从哪里开始。
客户端配置(服务器非常相似)
public HttpResponseMessage Get()
{
var content = new JavaScriptSerializer().Serialize(new { foo = "bar" });
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(content, Encoding.UTF8, "application/json")
};
response.Headers.CacheControl = new CacheControlHeaderValue
{
Public = true,
MaxAge = TimeSpan.FromSeconds(15)
};
return response;
}
// returns in the response: "Cache-Control: public, max-age=15"
这个周期起初非常零星,但经过一段时间它会重复,并且在服务重置之前不会再连接。
return ConfigurationFactory
.ParseString(string.Format(@"
akka {{
loggers = [""XYZ.AkkaLogger, XYZ""]
actor {{
provider = ""Akka.Remote.RemoteActorRefProvider, Akka.Remote""
serializers {{
json = ""XYZ.AkkaSerializer, XYZ""
}}
}}
remote {{
helios.tcp {{
transport-class = ""Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote""
applied-adapters = []
transport-protocol = tcp
port = 0
hostname = {0}
send-buffer-size = 512000b
receive-buffer-size = 512000b
maximum-frame-size = 1024000b
tcp-keepalive = on
}}
transport-failure-detector {{
heartbeat-interval = 60 s # default 4s
acceptable-heartbeat-pause = 20 s # default 10s
}}
}}
stdout-loglevel = DEBUG
loglevel = DEBUG
debug {{
receive = on
autoreceive = on
lifecycle = on
event-stream = on
unhandled = on
}}
}}
", Environment.MachineName));