Hi @Markus Freitag,
If you use Visual Studio's built-in web server (IIS Express), localhost is mapped by default. If you need to access the application through 127.0.0.1, you need to configure it. The following is the test I did:
I created a default project in VS, and when I choose to run this project using IIS express, I can access it normally via https://localhost:44365.
But if I change localhost to 127.0.0.1, the same error as yours will appear.
This is because I didn't configure it in the project. Next do the following.
1.Edit applicationhost.config located inside .vs\config (".vs" dirctory is hidden) in your project and add bindings for 127.0.0.1 for http and https:
<sites>
...
<site name="asp.net test" id="2"> <!-- your asp.net project -->
...
<bindings>
<binding protocol="https" bindingInformation="*:44365:localhost" />
<binding protocol="http" bindingInformation="*:55250:localhost" />
<binding protocol="https" bindingInformation="*:44365:127.0.0.1" />
<binding protocol="http" bindingInformation="*:55250:127.0.0.1" />
</bindings>
</site>
...
</sites>
2.Edit Project Url settings in VS: from solution explorer under the project tree > [your project] > properties > Web: change localhost to 127.0.0.1.
3.Save the changes and re-run the application, this time I can access the application using 127.0.0.1.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the email notification for this thread.
Best regards,
Yurong Dai