Web server failed to start. Port 80 was already in use. Solve the problem of Windows port being occupied

Web server failed to start. Port 80 was already in use A solution appears

The port is occupied:
the springboot project is started in the idea, and the port 80 is used. When the springboot project is started from the windows command, the console reports that the Web server failed to start. Port 80 was already in use The port is occupied

The solution is as follows:

1. To solve the problem of port occupation, first check the port startup status

win+R Enter cmd to open the DOS command box. Enter: netstat -ano | findstr 80 where 80 is the port number of my service.
insert image description here

The query result shows that port 80 is already occupied, so our next operation is to kill it;

We can also query the process name according to the process PID number: tasklist | findstr "18560"
insert image description here

2. Next we will kill it

Kill task by PID: taskkill /F /PID "18560"

insert image description here
This way we kill it, and then we can start the project up and running again.

Additional:

1. Query the specified port: netstat -ano | findstr "port number"
2. Query the process name according to the process PID: tasklist | findstr "process PID number"
3. Kill the task according to the PID: taskkill /F /PID "process PID number"
Or kill task by process name: taskkill -f -t -im "process name"

Guess you like

Origin blog.csdn.net/qq_39236283/article/details/125758011