Hello
You can refer to the article in the link, there is a detailed troubleshooting tutorial, I hope it can help you.
https://learn.microsoft.com/en-us/windows-server/get-started/activation-troubleshoot-kms-general
if the answer is helpful. please click "accept answer" and upvote it.