5

I'm playing around with a WCF service.

The problem I'm having is that VS2010 keeps randomly assigning a new port number to it when starting the VS Development Server even though I have set it to a specific port through the project settings.

If I keep stopping and starting VS Development Server for a few times with this problem, I get an error that says Unable to launch the ASP.NET Development server because port 'xxxx' is in use.

Why is this happening?

edit: It was suggested that this could be caused by the Dev Server not stopping. Unfortunately, it happens on a freshly started computer as well, i.e. when no instances of it are running at all.

Also, after I get the error message, it doesn't matter if I change the port, or select the Auto-assign Port option. The result is the same.

Moss
  • 855
  • 1
  • 9
  • 23

3 Answers3

4

I have seen it sometimes and it seems that the webserver doesn't stop at times. So next time you fire up your project, the previous server is running at the same port.

The solution is to explicitly close the previous one and retry.

Mrchief
  • 75,126
  • 20
  • 142
  • 189
  • 1
    Thanks for your answer. I have just started my work day on a computer that I turned on 5 minutes ago. I couldn't launch the application even for the first time as I got that error message I mentioned in the original post. :S – Moss Jul 26 '11 at 08:27
  • Have you checked its not running in background? If not, have you checked if the port is being blocked or in use by some other program? – Mrchief Jul 26 '11 at 16:09
  • Got to solve this by closing the previous servers clicking in "Show hidden icons" (the up arrow in the taskbar), right clicking each" ASP.Net Development Server" and clicking "Stop". – jcs Aug 30 '17 at 17:53
1

On the project properties of the web app project (right click and select Properties) Web tab, change the radio button to 'Specific Port' from auto select. That should make the port number totally consistent.

C. Pearson
  • 49
  • 3
0

It turns out that the problem was linked to the issue answered at Visual Studio Development Server using wrong port.

I didn't suspect this to be the cause because I didn't have a blanket problem. I could launch the WCF solution at times, but not at certain other times. I could also run an instance of the Dev Server for an MVC solution with a specific port applied without problems.

Community
  • 1
  • 1
Moss
  • 855
  • 1
  • 9
  • 23