.netcore api 可以用ip访问服务

原创 freeguy  2023-03-05 21:17:57  阅读 2495 次 评论 0 条

1、修改launchSettings.json:

applicationUrl增加本机ip和端口。

"applicationUrl": "http://localhost:44349/;https://192.168.1.11:7019;"


2、修改.vs\config\applicationhost文件:

<bindings>

<binding protocol="http" bindingInformation="*:54321:localhost" />

<binding protocol="https" bindingInformation="1192.168.1.11:7019:*" /> //这句代码加上

</bindings>


3、如果不行,尝试dos命令:ipconfig /flushdns


尝试只做1不生效,做了1、2生效一次后又失效,又尝试了3


----

其他方法:(未验证)

1、方法1:添加启动参数:--urls “http://192.168.1.11:5100”

2、网上还有其他方法,可查询。


本文地址:http://freedeman.top/?id=17
版权声明:本文为原创文章,版权归 freeguy 所有,欢迎分享本文,转载请保留出处!

评论已关闭!