'no connection could be made because the target machine actively refused it

My server gives an actively refused it error, what is the reason? After restarting, it works, but after a few hours of work, it gives an error again. What is the reason?

socketexception: 'no connection could be made because the target machine actively refused it