如何配置Blazor Web服务器以侦听IP地址? [英] How configure Blazor Web server to listen IP addresses?
问题描述
我构建了Blazor Web应用程序服务器,在计算机上运行它,但它仅在本地主机上响应,即 http://localhost:5000 但是当我从外部主机查询时没有响应 http://myhostIP:5000 这个myhostIP可以ping通.固件已关闭.在VS2019中的项目设置中:应用网址: https://localhost:5001; http://localhost:5000
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
如何配置Blazor Web服务器使用appsetings.json侦听(所有)主机IP地址而无需进行硬编码?
How to configure Blazor Web server to listen (all) hosts IP addresses using appsetings.json without hardcoding?
推荐答案
感谢David Fowler:这真的取决于你.您可以阅读自定义配置并设置适当的URL或将URL硬编码到应用程序本身中.
Thanx David Fowler: That's really up to you. You can read custom configuration and set the appropriate URLs or hard code a URL into the application itself.
https://andrewlock.net/5方式为一个aspnetcore-app设置URL/ https://josephwoodward.co.uk/2017/02/many-different-way-specifying-host-port-asp-net-core
这篇关于如何配置Blazor Web服务器以侦听IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!