This usually just means that the account you're using doesn't have permission to connect via RDP. Make sure it's either a member of the local Administrators group, or of the Remote Desktop Users group.
Note that the message looks a bit different on Windows 11, even though it's throwing the same basic error as Windows 10 or earlier.