How can windows server on Ali Cloud keep running all the time?

A windows server 2016 machine is opened on Aliyun. After the remote desktop is connected, open cmd to run a flask program (that is, a simple development server, app.run ()), is normal at this time, and there is no problem with external network access.
when the original cmd window is running, the remote desktop is closed and app can still be accessed for a short time, but it cannot be accessed after a few hours. This has happened several times. What is the cause of the problem? How can it be solved?


where does the server put the service in the foreground to run? It is obvious that the service running in the background should be run continuously to interface with the service function of windows. Refer to flask's product environment deployment document: http://flask.pocoo.org/docs/0.

you should directly use cgi to dock with web server


take a look at flask's log to see why you quit.
Real online services can restart automatically


1. The server has automatic sleep function, and the
2.flask process is killed
3. In development mode, it is not recommended to run it as a production mode all the time

Menu