简体   繁体   English

如何在 localhost Windows 上释放端口 80?

[英]How do I free my port 80 on localhost Windows?

I installed XAMPP 1.6.8 and for some reason it didn't work.我安装了 XAMPP 1.6.8,但由于某种原因它不起作用。 Later realized port 80 is not free or not listening.后来发现80端口不空闲或者不监听。 How can I release it or make it free?我怎样才能释放它或让它免费?

Thanks a lot!非常感谢!

That agony has been solved for me.那种痛苦已经为我解决了。 I found out that what was taking over port 80 is http api service.我发现接管 80 端口的是 http api 服务。 I wrote in cmd:我在cmd中写道:

net stop http

Asked me "The following services will be stopped, do you want to continue?"问我“以下服务将停止,您要继续吗?” Pressed y按下 y

It stopped a number of services actually.它实际上停止了许多服务。

Then wrote localhost and wallah, Apache is up and running on port 80.然后写localhost和 wallah,Apache 在 80 端口上启动并运行。
Hope this helps希望这可以帮助

Important : Skype uses port 80 by default, you can change this in skype options > advanced > connection - and uncheck "use port 80"重要提示:Skype 默认使用端口 80,您可以在 Skype 选项 > 高级 > 连接中更改此设置 - 并取消选中“使用端口 80”

netstat -ano

That will show you the PID of the process that is listening on port 80. After that, open the Task Manager -> Processes tab.这将显示正在侦听端口 80 的进程的 PID。之后,打开任务管理器 -> 进程选项卡。 From the View -> Select Columns menu, enable the PID column, and you will see the name of the process listening on port 80.View -> Select Columns菜单中,启用PID列,您将看到侦听端口 80 的进程名称。

I had this problem previously,我以前遇到过这个问题,

if you see the Task manager(after enabling the view for PID), you will find PID=4 is "port 80 in use by NT Kernel & System; "如果您看到任务管理器(启用 PID 视图后),您会发现 PID=4 是“NT 内核和系统正在使用的端口 80;”

Just go to就去

  1. Control Panel控制面板
  2. Programs程式
  3. Turn Windows features on/off打开/关闭 Windows 功能
  4. check if the World wide web services under IIS is checked检查IIS下的World wide web services是否勾选

If so, Uncheck and netstat(or TCPVIEW) again to see if 80 is free.如果是这样,再次取消选中和 netstat(或 TCPVIEW)以查看 80 是否空闲。

netstat -a -b

应该告诉你什么程序绑定到了 80 端口

use netstat -bano in an elevated command prompt to see what apps are listening on which ports.在提升的命令提示符中使用netstat -bano来查看哪些应用程序正在侦听哪些端口。

But Usually following applications uses port 80 in windows.但是通常以下应用程序在 Windows 中使用端口 80。

  1. IIS信息系统
  2. World Wide Web Publishing service万维网发布服务
  3. IIS Admin Service IIS 管理服务
  4. SQL Server Reporting services SQL Server 报告服务
  5. Web Deployment Agent Service Web 部署代理服务

Stop above applications if running and check!!!如果正在运行,请停止上述应用程序并检查!!!

使用TcpView查找监听端口的进程并关闭进程。

You can use net stop http it will display which process is using.您可以使用net stop http它将显示正在使用的进程。 Moslty world wide web services are using Moslty 万维网服务正在使用

Type in "netstat -ano" into your command line.在命令行中输入“netstat -ano”。 I saw that it was showing something for Local Address port 0.0.0.0:80.我看到它显示了本地地址端口 0.0.0.0:80 的内容。

My issue was because I had SQL Server Reporting Services on Port 80. So I followed these instructions and changed the port # from 80 to 81:我的问题是因为我在端口 80 上有 SQL Server Reporting Services。所以我按照这些说明将端口号从 80 更改为 81:

http://seankilleen.com/2012/11/how-to-stop-sql-server-reporting-services-from-using-port-80-on-your-server-field-notes/ http://seankilleen.com/2012/11/how-to-stop-sql-server-reporting-services-from-using-port-80-on-your-server-field-notes/

Here is a picture of my command line AFTER I changed the port number for SQL Server Reporting Services:这是更改 SQL Server Reporting Services 端口号后命令行的图片:

在此处输入图片说明

If you are still having the same issue, read this forum:如果您仍然遇到相同的问题,请阅读此论坛:

http://forum.wampserver.com/read.php?2,66196,66233#REPLY http://forum.wampserver.com/read.php?2,66196,66233#REPLY

尝试的其他选项是停止 SQL Server Reporting Services。

Try尝试

netstat -anb -p tcp

that show ports and processes显示端口和进程

This is just a guess, but since port 80 is the conventional port for HTTP, you may have a webserver running on your system.这只是一个猜测,但由于端口 80 是 HTTP 的常规端口,因此您的系统上可能有一个网络服务器正在运行。 Is IIS active? IIS 是否处于活动状态?

If you are running IIS you may have the web farm service running.如果您正在运行 IIS,您可能正在运行 Web 场服务。 That was what was killing my xampp.这就是杀死我的 xampp 的原因。

Skype likes to use port 80 and blocks IIS. Skype 喜欢使用端口 80 并阻止 IIS。 That was my prob.那是我的问题。

I also had the same problem.我也有同样的问题。 net stop http didn't help and World wide web services option under IIS in Windows Control Panel was unchecked. net stop http没有帮助,Windows 控制面板中IIS下的万维网服务选项未选中。 So in XAMPP control panel I just checked the Svc checkbox near Apache start button (Install Apache as service) and rebooted Windows.因此,在 XAMPP 控制面板中,我刚刚选中了 Apache 启动按钮(将 Apache 作为服务安装)附近的 Svc 复选框并重新启动了 Windows。 And now each time Windows starts Apache is started automatically and occupies port 80 before any other service does.现在每次 Windows 启动时,Apache 都会自动启动并在任何其他服务之前占用端口 80。 Worked for me!为我工作!

Known Windows Services That Listen on Port 80侦听端口 80 的已知 Windows 服务

From Services Manager (run: services.msc), stop and disable these Windows Services which are known to bind to port 80.从服务管理器(运行:services.msc),停止并禁用这些已知绑定到端口 80 的 Windows 服务。

Double click Service, and change 'Startup Type' to 'Disabled'…双击“服务”,将“启动类型”更改为“已禁用”...

  1. SQL Server Reporting Services (ReportServer) SQL Server 报告服务 (ReportServer)
  2. Web Deployment Agent Service (MsDepSvc) Web 部署代理服务 (MsDepSvc)
  3. BranchCache (PeerDistSvc) BranchCache (PeerDistSvc)
  4. Sync Share Service (SyncShareSvc)同步共享服务 (SyncShareSvc)
  5. World Wide Web Publishing Service (W3SVC)万维网发布服务 (W3SVC)
  6. Internet Information Server (WAS, IISADMIN) Internet 信息服务器(WAS、IISADMIN)

skype also using port 80 as default setting and you can uncheck it. skype 也使用端口 80 作为默认设置,您可以取消选中它。

You might, or might not, have some of these Services installed and running.您可能会或可能不会安装并运行其中的某些服务。

In my case "SQL Server Reporting Services" was opening port 80.就我而言,“SQL Server Reporting Services”正在打开端口 80。

I was trying to install nginx from here - http://nginx.org/en/docs/windows.html我试图从这里安装nginx - http://nginx.org/en/docs/windows.html

Going to http://localhost/ will show something, at least a proper "not found" message转到http://localhost/将显示一些内容,至少是正确的“未找到”消息
This is because 80 is the default port, and it was taken by other processes.这是因为 80 是默认端口,它被其他进程占用。

Now run below command:现在运行以下命令:

net stop http

    // Above command stopped below services  
    // - SSDP Discovery  
    // - Print Spooler  
    // - BranchCache  
    // - Function Discovery Resource Publication  
    // - Function Discovery Provider Host  

Now, going to http://localhost/ will fail with a broken link page message.现在,访问http://localhost/将失败,并显示一个断开的链接页面消息。

Main process was BranchCache主要进程是BranchCache
This process, after stopped, will restart in a few seconds.此过程停止后,将在几秒钟后重新启动。
So we need to run other commands we need soon, an example below:所以我们需要尽快运行其他我们需要的命令,下面是一个例子:

// this will stop
net stop http

// immeidately run other command you want to
start nginx

Now, going to http://localhost/ gave me:现在,去http://localhost/给了我:

Welcome to nginx!

Hope that helps.希望有帮助。

I faced the same issue and fixed it by making a small change in the httpd.conf file which can be obtained by clicking the config button along with the Apache option.我遇到了同样的问题,并通过对httpd.conf文件进行了一些小的更改来修复它,该文件可以通过单击配置按钮和 Apache 选项来获得。

The change I made was to replace listen 80 with listen 8080.我所做的更改是将 listen 80 替换为 listen 8080。

Identify the real process programmatically以编程方式识别真正的流程

(when the process ID is shown as 4) (当进程ID显示为4时)

The answers here, as usual, expect a level of interactivity.像往常一样,这里的答案需要一定程度的交互性。

The problem is when something is listening through HTTP.sys;问题是当某些东西通过 HTTP.sys 侦听时; then, the PID is always 4 and, as most people find, you need some tool to find the real owner.然后,PID 始终为 4,并且正如大多数人所发现的那样,您需要一些工具来找到真正的所有者。

Here's how to identify the offending process programmatically.以下是如何以编程方式识别违规进程。 No TcpView, etc (as good as those tools are).没有 TcpView 等(和那些工具一样好)。 Does rely on netsh;是否依赖netsh; but then, the problem is usually related to HTTP.sys.但是,问题通常与 HTTP.sys 有关。

$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
    }
}

Originally posted here: https://stackoverflow.com/a/65852847/6274530最初发布在这里: https : //stackoverflow.com/a/65852847/6274530

For me, this problem began when I hosted a VPN-connection on my Windows 8 computer.对我来说,当我在 Windows 8 计算机上托管 VPN 连接时,这个问题就开始了。

Simply deleting the connection from "Control Panel\\Network and Internet\\Network Connections" solved the problem.只需从“控制面板\\网络和 Internet\\网络连接”中删除连接即可解决问题。

I installed XAMPP 1.6.8 and for some reason it didn't work.我安装了XAMPP 1.6.8,由于某种原因,它无法正常工作。 Later realized port 80 is not free or not listening.后来意识到端口80不空闲或没有监听。 How can I release it or make it free?我该如何释放它或使其免费?

Thanks a lot!非常感谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM