Visual Studio Development Server using wrong port

2019-01-17 10:58发布

问题:

Related to a previous issue that I thought was resolved and actually isn't...

My Visual Studio 2008 installation may be a bit messed up, I think.

  1. When my ASP.NET project is set up to use VS Dev Server with a fixed port, I get the "Port in use" error described in the linked question.
  2. When my project is set up to use a random (auto-assigned) port number, it works, but it launches the browser using a port number 3 less than the actual Dev Server port number (e.g. if the port number is 1903, the browser launches to http://localhost:1900/)
  3. If I make changes to the project settings, they do not "take" until I save and restart Visual Studio.

Any ideas how to track this one down?

Thanks!

回答1:

I had a similar problem which hit my 2 main machines at the same time. On investigating I found it to be related to the Eset personal security (guessing a recent update messed something up). To solve it I excluded VS2008 from the active browser filtering - this is in: setup -> advanced firewall setup -> antivirus & anti spyware -> web access protection -> HTTP -> webbrowsers

Deselecting vsdev in here fixed the problem - interestingly enough disabling the firewall and antivirus / antispyware did not solve the issue, so it is worth looking for a similar setting if you are running different security software



回答2:

First try to kill all "WebDev.WebServer.exe" processes.

  • In Solution Explorer, click the name of the application.
  • In the Properties pane, click the down-arrow beside Use dynamic ports and select False from the dropdown list.This will enable editing of the Port number property.
  • In the Properties pane, click the text box beside Port number and type in a port number.
  • Click outside of the Properties pane. This saves the property settings.

Hope this helps



回答3:

I do absolutely agree with Macros' answer. Just want to share solution for Eset Nod32 v5

In ESET NOD32 v5 to allow Visual Studio to run Development or IIS Express server you must uncheck Visual Studio in Nod32 Advanced Setup => Web and Email => Protocol filtering => Web and email clients



回答4:

Weird!

The port number is stored in the .sln file. So, I'd blow that away the solution file first, re-create it and see what happens. If that doesn't help, I'd then move onto the web.config file and blow that away and start again too.



回答5:

I also encountered the same error message:

Unable to launch Visual Studio development server because port [xxxx] is in use.

However, I do not have ESET installed. Instead, I had recently installed GlassFish server on my machine and that was causing the problem. Therefore, in Windows Task Manager, I killed the process it runs under which is java.exe and it fixed the problem.



回答6:

This also applies to Visual Studio 2010.

And there is more to it.

Symptoms:

  • A Web (Services) project is configured to run at a specific port, e.g. 10080.
  • After a while Visual Studio compains “Unable to launch the Visual Studio Development Server because port ’10080′ is in use
  • The reason is still unclear. It might have something to do with the webdev server crashing.
  • Restarting the pc doesn't solve the problem.
  • Netstat doen’t show an entry for the port 10080
  • Manually startin WebDev.WebServer40.exe at port 10080 works fine.

Since I'd like to start from within Visual Studio, I moved to port 10081, then to 10082, and today to 10083. I’m running out of ports.

Solutions that did not work:

  • Restart Visual Studio
  • Tweaking Trendmicro security settings (couldn't access them)
  • Disabling Forticlient antivirus/firewall

Workaround that DOES work:


  • Configuring my project to manually start the server
  • Right click the project, choose properties
  • Click the tab "Web"
  • Pick for start action "Start external program" and point it to Webdev.Webserver40.EXE (for me: C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\WebDev.WebServer40.EXE)
  • Command line arguments: /port:10080 /path:C:\Solution\Project
  • Working directory: C:\Solution\Project
  • Under servers check "Use Custom Web Server"
  • Do not check any debugger checkbox

Side effect: my project thinks break points are not getting hit. ("no symbols loaded"). Turns out they work like they should.

I hope anybody ever finds a definitive solution, but up until then this workaround does the trick for me.



回答7:

To solve your problem, just restart your PC. I've had the same problem, I did the same thing.