[Solved] Linux WebService Startup Error: BindException: Cannot assign requested address

Linux deploys the WebService service and starts the error bindexception: cannot assign requested address

code

Question

The windows local test is normal. When it is deployed to the Linux server, an error is reported when it is started: BindException: Cannot assign requested address

Cause of problem

There is a problem with the IP in the URL. If Alibaba cloud and other cloud servers are used, you need to check the address of the network card eth0, and then change the IP in the URL to the IP of eth0

if not, check whether the IP of eth0 is configured or not in /etc/hosts. If not, add: IP + hostname
if you do not know the hostname, you can use the hostname command to check. If not, vim /etc/hosts, and then insert the data: IP hostname. Note that there is a space in the middle

Finally, when accessing WebService, the service can be accessed through public IP

Read More: