How configure Blazor Web server to listen IP addresses?

Viewed 5438

I build a Blazor Web app server, run it on machine but it responds on localhost only, i.e. http://localhost:5000 but does not respond when I query it from an exrternal host http://myhostIP:5000 This myhostIP pinged ok. FW is off. In VS2019 in the project settings: App URL: https://localhost:5001;http://localhost:5000

How to configure Blazor Web server to listen (all) hosts IP addresses using appsetings.json without hardcoding?

3 Answers

In my case I've added the entry https://*:5001 in the file launchSettings.json so that it looks like this:

"applicationUrl": "https://localhost:5001;http://localhost:5000;https://*:5001"

If you're using Kestrel, it is not designed to be used outside localhost. You can use a reverse proxy (like Nginx for instance) to expose your application to the outside world.

Image from MSDN:

enter image description here

Related