I registered my domain and added the key but want to test the site on my local machine. I publish the project on my machine to wwwroot and at the moment it runs on port number 8
Check your domains at https://www.google.com/recaptcha/admin, if you are using localhost you most set your domain to "localhost".