2

I am working on an asp.net core MVC web application, and i need to test the google captcha with it, and one requirement is to access my application inside visual studio 2019 using 127.0.0.1 instead of local host, but when i run my application >> try to access the following https://127.0.0.1:44363/ >> i got this error Bad Request - Invalid Hostname.. any advice how i can access my web application using https://127.0.0.1:44363/ instead of using https://localhost:44363/?? Thanks

John John
  • 1
  • 72
  • 238
  • 501

1 Answers1

0

As a workaround you can map 127.0.0.1 to localhost manually. To do so, go to hosts file(location should be something like c:\Windows\System32\Drivers\etc\hosts) and add following line and save the file:

127.0.0.1 localhost
Eugene
  • 1,487
  • 10
  • 23
  • i already has this defined inside my hosts file `127.0.0.1 localhost` – John John Jul 10 '20 at 23:04
  • Check out this similar post https://stackoverflow.com/questions/23403912/c-sharp-web-localhostport-works-127-0-0-1port-doesnt-work – Eugene Jul 10 '20 at 23:10