在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]我更改了端口,但没有任何更改。
我在WSL2中测试了一个docker图像,我可以通过chrome正常访问。
docker run --publish 8000:8000 amazon/dynamodb-local:1.11.477 -jar DynamoDBLocal.jar -inMemory -sharedDb我测试了另一个用vite/vue编写的应用程序,也可以正常访问。
发布于 2021-07-28 13:10:01
尝试在application.properties中设置quarkus.http.host=0.0.0.0
发布于 2021-08-24 04:37:06
当我第一次尝试Quarkus时,我遇到了同样的问题。我遵循了https://quarkus.io/guides/maven-tooling的指导
这里有一个指导
By default, quarkus:dev sets the debug host to localhost (for security reasons). If you need to change this, for example, to enable debugging on all hosts, you can use the -DdebugHost option like so:
./mvnw compile quarkus:dev -DdebugHost=0.0.0.0它帮助我解决了这个问题。希望这对其他人也有帮助。
https://stackoverflow.com/questions/68553061
复制相似问题