简体   繁体   English

无法访问 WSL 2 Windows 内部开发模式下 Quarkus 应用程序公开的 chrome 中的 localhost 端口

[英]Can't access localhost port in chrome exposed by a Quarkus application in dev mode inseide WSL 2 Windows

All my applications written in Quarkus/Java can't be accessed in localhost:8000 exposed in dev mode when running inside WSL 2.在 WSL 2 中运行时,我所有用 Quarkus/Java 编写的应用程序都无法在开发模式下公开的 localhost:8000 中访问。

    __  ____  __  _____   ___  __ ____  ______ 
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
2021-07-27 21:13:15,739 INFO  [io.quarkus] (Quarkus Main Thread) products 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.0.3.Final) started in 1.613s. Listening on: http://localhost:8080
2021-07-27 21:13:15,744 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-07-27 21:13:15,745 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [amazon-dynamodb, cdi, resteasy, resteasy-jackson, smallrye-context-propagation, smallrye-openapi, swagger-ui]

I changed the port and nothing changed.我改变了端口,没有任何改变。

I test run an docker image inside WSL 2 and I can access normally through the chrome.我在 WSL 2 中测试运行了一个 docker 镜像,我可以通过 chrome 正常访问。

docker run --publish 8000:8000 amazon/dynamodb-local:1.11.477 -jar DynamoDBLocal.jar -inMemory -sharedDb

I test another application written in vite/vue and can be accessed normally too.我测试了另一个用vite/vue写的应用,也可以正常访问。

尝试在application.properties设置quarkus.http.host=0.0.0.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM