2014-09-21 332 views
1

我無法殺死綁定到8000端口的進程,因此我無法啓動HTTP服務器。這是關於問題 Start HTTP/HTTPS server, python -m SimpleHTTPServer端口8000,PID 4,無法殺死,taskill/f/pid 4,拒絕訪問

C:\>taskkill /f /pid 4 
ERROR: The process with PID 4 could not be terminated. 
Reason: Access is denied. 

即使按以下不能正常工作,我發現某處殺。

C:\>taskkill /f /s localhost /pid 4 
ERROR: The process with PID 4 could not be terminated. 
Reason: Access Denied. 

PID 4是系統進程,哪些可能在那裏運行,我該如何阻止它,爲什麼其他端口被以類似的方式傾聽。

C:\>netstat -ab 

Active Connections 

    Proto Local Address   Foreign Address  State 
    TCP 0.0.0.0:135   garg10may-PC:0   LISTENING 
    RpcSs 
[svchost.exe] 
    TCP 0.0.0.0:443   garg10may-PC:0   LISTENING 
[vmware-hostd.exe] 
    TCP 0.0.0.0:445   garg10may-PC:0   LISTENING 
Can not obtain ownership information 
    TCP 0.0.0.0:902   garg10may-PC:0   LISTENING 
[vmware-authd.exe] 
    TCP 0.0.0.0:912   garg10may-PC:0   LISTENING 
[vmware-authd.exe] 
    TCP 0.0.0.0:8000   garg10may-PC:0   LISTENING 
Can not obtain ownership information 
+0

運行您命令提示符爲管理員。 – g4ur4v 2014-09-21 06:39:50

+0

是的,僅以管理員身份登錄 – garg10may 2014-09-21 06:40:53

回答

2

作爲每蟒documentationhttp.server模塊也可使用-m開關的直接調用的帶端口號參數的解釋器。與前面的例子類似,這爲相對於當前目錄的文件提供服務。

python -m http.server 8000 

如果你的8000端口已經被用來只是將其更改爲另一個沒有。

python -m http.server 5000 

這是不是一個好主意,任意殺死進程和更多的系統進程。

1

不要這樣做 - 有一個原因,你不能殺死它,因爲你沒有啓動它。代替通過另一個端口號:

對於Python 3:

python -m http.server 8080 

對於Python 2:

python -m SimpleHTTPServer 8080 
+0

是的,能夠從另一個端口啓動,但仍然好奇可能在該端口上運行的是什麼,並且該情況也是我應該能夠殺死的。 – garg10may 2014-09-21 10:55:03

1

,如果你在Windows是這可能會幫助你,80端口通常使用此服務:「萬維網發佈服務」,打開「服務」控制面板中,並阻止它