[英]Datasnap session has expired
I've been using client server application using datasnap... Everything works flawlessly until server is restarted.我一直在使用使用 datasnap 的客户端服务器应用程序......在服务器重新启动之前,一切都完美无缺。 Once server is restarted client has to be restarted as well.
一旦服务器重新启动,客户端也必须重新启动。 If do not restart client, client can't communicate with server because of annoying issue "session has expired".
如果不重新启动客户端,客户端无法与服务器通信,因为烦人的问题“会话已过期”。 Who faces same issue?
谁面临同样的问题? How to solver?
如何求解? Thanks
谢谢
I've created example project to clarify what I mean.我创建了示例项目来阐明我的意思。 Download link
下载链接
Steps to reproduce the issue:重现问题的步骤:
Ok, It seems I found a solution.好的,看来我找到了解决方案。
On client side just set TDSRestConnection.PreserveSessionID=False.在客户端只需设置 TDSRestConnection.PreserveSessionID=False。 I suppose every request will have new session id, thus it will never expire...
我想每个请求都会有新的 session id,因此它永远不会过期......
TDSRestConnection.PreserveSessionID=False
It is an easy way to create a new session each time, but it can put unnecessary stress on the server.每次创建一个新的 session 是一种简单的方法,但它会给服务器带来不必要的压力。
When a session timeout occurs, it is better to initialize the session with the code below and request again.当发生 session 超时时,最好使用下面的代码初始化 session 并再次请求。
TDSRestConnection.SessionID := '';
Handling the client like this and properly adjusting the server's session timeout time can make the server more effective.像这样处理客户端并适当调整服务器的 session 超时时间可以使服务器更有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.