Enable Dynamic Port = False on Web [Service] Projects


 When developing a web site with web service references recently, we had difficulty checking the code out of Team Foundation Server and running it on a new developer's machine.  We quickly figured out that it was because the web references were referring to a specific port in the web.config file which the web services used to fire up on the original machine which the solution was created.  These ports were burned into the web.config, so when we ported it to another machine, the web services were not guaranteed to fire up on the same ports.  Thus, exceptions were thrown which indicated that the web server could not be reached.  We could have manually edited the config file to the correct port, but that would have changed the next time the solution fired up (since ports are dynamic for web apps by default). 


The way around this is to specify on each web service that the [Use dynamic ports] property is set to false.  This will ensure that the project attempts to fire up on the same port each time.

Skip to main content