Jenkins agent keeps disconnecting on windows slave
I have a Jenkins master on Azure linux machine and have an Azure Windows VM as a slave. The slave connects using the option ""Launch agent by connecting it to the master".
When the launch command is run on the Windows machine, the agent does connect but it disconnects after some time (around 20-30 minutes). I tried running the agent as a windows service but the service keeps restarting very frequently and if the master makes any request to this slave during this restart time, the build fails.
Can someone here give me a more robust solution to this issue?