无法启动 ASP.NET 开发服务器,因为端口“1900”已关闭 正在使用中
我在 VS 2008 中开发得很好,并在我的开发服务器上测试我的 ASP.NET 网站,突然我无法再运行我的网站了。 当我按下 F5 时,就会出现以下消息:
无法启动 ASP.NET 开发服务器,因为端口“1900”正在使用中。
无论我更改为哪个端口,它始终在使用中。 我尝试过:
- 更改端口号
- 重新启动 Visual Studio
- 重新启动我的计算机
- 安装 IIS
线索:我的 IIS 拒绝启动。 但我之前愉快工作时没有安装 IIS,所以这可能不是问题所在; 它可能只是强调其他东西。
更新:重新启动后,IIS 确实启动,但问题仍然存在。
I was developing just fine in VS 2008 and testing my ASP.NET web site on my development server when suddenly I was unable to run my web site anymore. As soon as I hit F5, the message appears:
Unable to launch the ASP.NET Development server because port '1900' is in use.
It doesn't matter what port I change to, it's always in use. I have tried:
- Changing the port number
- Restarting Visual Studio
- Rebooting my machine
- Installing IIS
Clue: My IIS refuses to start. But I didn't have IIS installed when I was happily working earlier, so that is probably not the issue; it might just be highlighting something else.
Update: after rebooting, IIS does start, but the problem here persists.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(21)
简单地结束所有 Webdev.WebServer.exe 进程 - 为我解决了这个问题。
当 Visual Studio 进程之一 (webdev.webserver.exe) 仍在运行并锁定时,有时会出现“由于端口正在使用而无法启动”错误。 当您关闭浏览器或应用程序时,webdev.webserver 进程应该结束,但如果它们没有结束(例如我的 Visual Studio 崩溃了,但如果让 Web 服务器仍在运行),那么这可能会锁定端口,这将阻止 Visual Studio 启动你的项目。 当您尝试 F5 您的应用程序(从 Visual Studio 启动您的应用程序)时,它与当前使用的端口冲突,并显示上述“因为端口 XYZ 正在使用”错误。
因此,要解决此问题:在状态栏(Windows 时钟旁边)中右键单击并“停止”所有 ASP.net 开发服务器图标。 您还可以打开任务管理器并终止所有 webdev.webserver.exe 进程。
Simply end all Webdev.WebServer.exe processes - did the trick for me.
Occasionally this 'unable to launch because port is in use' error happens when one of the visual studio processes (webdev.webserver.exe) is still running and locked. The webdev.webserver process(s) should end when you close your browser or app but if they dont (for instance my Visual Studio crashed but if left the webserver still running) then this could lock the port and this will prevent visual studio from launching your project. When you try to F5 your app (launch your application from visual studio) then it conflicts with the current port in use and the above 'because port XYZ is in use' error is displayed.
So to fix it: in the status bar (next to your windows clock) right-click and 'Stop' all the ASP.net development server icons. You can also open task manager and kill all the webdev.webserver.exe processes.
您可以通过从命令提示符运行
netstat -o
来检查给定端口上正在运行哪些软件。 它将给出进程的进程 ID (PID)。 我在安装 Skype 后就遇到过这种情况,它先于 IIS 绑定到端口 80。您还可以检查事件日志以查找 IIS 无法启动的原因的消息。 它可能会提供足够的信息来解决问题或通过谷歌搜索。
You can check what software is running on given port by running
netstat -o
from the command prompt. It will give the Process ID (PID) of the process. I've had this happen after installing Skype, that was bound to port 80 before IIS could.You can also check the eventlog for messages why IIS won't start. It might give enough information to solve the problem or to google it.
我配置 NOD32 防火墙,不再像浏览器一样看到 VS,问题就解决了。
设置>防病毒& AntiSpy>Internet防护>HTTP
只要取消勾选vs,问题就可以解决。
我希望这最终能有所帮助。
The problem was solved for me configuring NOD32 firewall to no longer see VS like a browser.
Setup>Antivirus & AntiSpy>Internet protection>HTTP
Just uncheck the vs, and the issue will be resolved.
I hope this finally helps.
在 VS 2019 中,右键单击项目属性选择“调试”,向下滚动到 Web 服务器设置,更改 AppURL 中的端口号
In VS 2019, right click on project properties select Debug, scroll down to web server settings, change port number in AppURL
右键单击任务栏中运行的小“服务器页面”,然后单击“关闭”。 当 DEBUG 进程意外终止或 Visual Studio 崩溃时,通常会发生这种情况。 尝试一个非常高的端口,例如 50000,看看它是否有效。 不应该有任何进程使用该端口。
Right click on the little "server page" running in your task bar, and click close. This usually happens when the DEBUG process terminates unexpectedly, or visual studio crashes. Try a really high port like 50000 and see if it works. There shouldn't be any processes using that port.
我有同样的问题很长一段时间。 我检查了这里写的所有想法。 最终,唯一对我有用的是:
有时它可以解决问题...
但是,我还有一个解决方法:
webdev.webserver.exe /port:[your_port] /path:"[your_path]"
your_port 是服务器所需的端口, your_path是VS存储源文件的路径。 请注意,您只需粘贴 .asmx 文件所在的目录。
I had the same problem for a long time. I checked all the ideas written here. Eventually the only thing that worked for me was:
Sometimes it solves the problem...
However, I also have a workaround:
webdev.webserver.exe /port:[your_port] /path:"[your_path]"
your_port is the desired port for the server, your_path is the path where VS stores your source file. Note that you need to paste only the directory where your .asmx file is.
我找到了一个不需要重新启动的解决方案(适用于 Windows 7)。
在时钟旁边,有一个图标托盘,如果您单击旗帜旁边的三角形图标,则可以访问该图标。 查找带有工具提示“ASP.net 开发服务器 - 端口 ###”的图标。 右键单击并选择“停止”!
I found a solution that doesn't require rebooting (for Windows 7).
Next to the clock, there's a tray of icons that is accessible if you click on the triangle icon that is next to the flag. Look for an icon with tooltip "ASP.net development server - port ###". Right click and select "stop"!
过去,当发生这种类型的事情时,我尝试过的一件事是远程登录到端口并执行 GET 或 HEAD:
然后输入 HEAD 并按 Enter 键。 有时,返回的数据会显示服务器名称或应用程序名称之类的内容。
One thing I have tried in the past when this type of thing happened is telneting to the port and doing a GET or HEAD:
Then type in HEAD and press enter. Sometimes the data returned shows something like a server name or an application name.
对于 Web 表单站点:
For a webforms site:
只要重新启动系统,问题就解决了。
Just re-start the system , Problem would be resolved.
将 Cassini(Visual Studio 的轻量级内置 Web 服务器)设置为使用不同的端口。 您可以在项目的配置对话框中执行此操作
Set Cassini (Visual studio's lightweight built in web server) to use a different port. You can do this in the project's configuration dialogs
我今天遇到了同样的问题,找到了一个解决方案,所以我想我应该添加我的两分钱:
我的特殊问题是,即使开发服务器显然正在运行并且我能够使用,我也会收到“端口正在使用”错误消息其上的应用程序。 事实证明,我当时正在开发一个 Web 服务,并且碰巧打开了设计视图 - 没有意识到。 正是这个 Web 服务的设计视图试图启动开发服务器 - 这就是为什么我无法在不收到错误的情况下键入单个字符的代码。
关闭 Web 服务的设计视图...问题已解决。
我真诚地希望有一天这对其他人也有帮助。
干杯
伊恩
I had this same problem today and found a solution so I thought I would add my two cents:
My particular problem was that I would get the "Port in use" error message even though the development server was clearly running and I was able to use the application on it. As it transpired, I was working on a Web Service at the time and happened to have the design view open - without realising. It was this web service's design view that was trying to launch the development server - which is why I couldn't type a single character of code without getting the error.
Close your Web Service's design view... problem solved.
I sincerely hope this helps someone else someday too.
Cheers
Iain
我遇到了同样的问题,“无法启动 asp.net 开发服务器”,原因是病毒程序...我已禁用它,它可以正常工作...
我希望这会有所帮助...
I had same problem, "unable to launch asp.net development server" The reason is virus program... I had disable it the it works properly...
I hope this helps...
只需检查侧边栏中是否有两个正在运行的 vs2008 实例..:)
Just check there are two instance of vs2008 running in the sidebar.. :)
请注意 - 我在端口 8000 上遇到了此错误,结果发现我仍在运行 Aptana Studio - 它显然在端口 8000 上运行 java 服务器。退出 Aptana 后一切正常。
Just a heads up - I came across this error for Port 8000 and it turns out that I still had Aptana Studio running - which apparently runs a java server on port 8000. Exited Aptana and everything works.
我遇到过同样的问题。 问题是我还配置了 IIS 以使用这些端口。 停止 IIS 或更改解决方案中使用的端口可能是解决方案。
I had the same issue. The problem was that I also had IIS configured to use those ports. Stopping IIS or changing the ports used in the solution was may solution.
我只是停止了服务 MsDepSvc - Web 部署代理服务。 然后我就可以运行该网站了。
I simply stopped service MsDepSvc - Web Deployment Agent Service. Then I was able to run the site.
更改 IIS Express 的 Visual Studio (Web) 项目属性部分中的端口为我解决了同样的问题
changing the port in Visual studio (Web) Project Properties for IIS express section solved the same problem for me
在项目的网站部分,右键单击并执行“属性窗口”而非“属性页”将“使用动态端口”更改为 TRUE。 如果列出的端口是 80,则可以将其保留在那里 - 关键是使用动态端口。
In the website portion of the project, right click and do "Properties Window" NOT "Property Pages" Change "Use Dynamic Ports" to TRUE. You can keep 80 there if it's the port listed--the key is to Use Dynamic Ports.
我遇到了同样的问题。 但是当我删除所有窗口临时文件时,这对我有用。
键盘输入:1 - window键+r(打开运行窗口),然后在运行窗口中输入“temp”,然后删除所有文件。
2 - 在窗口运行中输入“%temp%”并删除所有文件。
上述步骤可解决问题。
I faced same issue. But this is working for me when I deleted all window temp files.
keyboard typing : 1 - window key + r(open run window) then type "temp" in run window and then delete all files.
2 - type "%temp%" in window run and delete all files.
Above steps resolve by issue.
我的问题(54790 正在使用中)通过以下步骤解决:
1-启动 IIS 管理器。 执行此操作的一种快速方法是打开“运行”命令,然后键入 inetmgr 并单击“确定”按钮。
2-在窗口左侧的“连接”窗格中,导航到您要检查其绑定的服务器和站点。
3-打开绑定。在右侧的“操作”窗格中,单击“绑定...”
4-删除正在使用的端口。
my problem (54790 is in use) solved by following the steps below:
1-Start IIS Manager. One quick way to do this is by opening the Run command, then typing inetmgr and clicking the OK button.
2-In the Connections pane on the left side of the window, navigate to the Server and Site you wish to check its binding .
3-Open bindings.In the Actions pane on the right, click Bindings…
4-delete the port which is in used .