我试图为我的应用服务器使用端口80,但当我执行netstat -aon时,我得到:

TCP 0.0.0.0:80 0.0.0.0:0监听4

当我在任务管理器中查找进程时,它显示PID 4是SYSTEM,就是这样。没有扩展…什么都没有。“系统”。这是怎么回事?

我害怕结束这个过程,我该怎么办?


当前回答

WINDOWS 11

对我来说,是万维网发布服务(World Wide Web Publishing Service)让系统使用80端口。

希望这对Win11新用户有所帮助。

其他回答

这不能解释PID方面的事情,但如果你运行Skype,它喜欢使用端口80出于某种原因。

听起来好像IIS正在监听HTTP请求的80端口。

尝试通过进入控制面板/管理工具/Internet信息服务停止IIS,右键单击默认网站,然后单击弹出菜单中的停止选项,并查看端口80上的侦听器是否已清除。

以编程方式标识流程

到目前为止,所有的答案都要求用户进行一些交互操作。这就是当netstat显示PID 4时如何找到PID,而不需要打开一些GUI或处理有关依赖服务的对话。

$Uri = "http://127.0.0.1:8989"    # for example


# Shows processes that have registered URLs with HTTP.sys
$QueueText = netsh http show servicestate view=requestq verbose=yes | Out-String

# Break into text chunks; discard the header
$Queues    = $QueueText -split '(?<=\n)(?=Request queue name)' | Select-Object -Skip 1

# Find the chunk for the request queue listening on your URI
$Queue     = @($Queues) -match [regex]::Escape($Uri -replace '/$')


if ($Queue.Count -eq 1)
{
    # Will be null if could not pick out exactly one PID
    $ProcessId = [string]$Queue -replace '(?s).*Process IDs:\s+' -replace '(?s)\s.*' -as [int]

    if ($ProcessId)
    {
        Write-Verbose "Identified process $ProcessId as the HTTP listener. Killing..."
        Stop-Process -Id $ProcessId -Confirm
    }
}

那可真让我受不了。我讨厌HttpListener,希望我只使用Pode。

如果你运行的是Windows Server 2012 R2,那么确保去掉工作文件夹:http://blogs.technet.com/b/filecab/archive/2013/10/15/windows-server-2012-r2-resolving-port-conflict-with-iis-websites-and-work-folders.aspx 删除文件服务器下的工作文件夹功能对我有用。

我发现“SQL Server Reporting Services (MSSQLSERVER)”自动启动并在端口80上监听。

我希望这能有所帮助。

O