如何使Swagger监听IP而不是本地主机?

时间:2019-11-18 04:43:15

标签: c# swagger swagger-ui

我在桌面应用程序中集成了Swagger,监听端口8081(http://localhost:8081)。 Swagger-ui在http://localhost:8081/docs上可用 您会在这里看到它仅在本地主机上监听。

如何让服务器监听服务器的实际IP地址,例如10.12.13.23而不是localhost?

当我想从另一台PC访问它并发送和接收API响应时,如何配置以侦听IP地址?

1 个答案:

答案 0 :(得分:0)

您需要在application.properties文件中设置spring.rest.hostname属性

spring.rest.hostname=10.12.13.23