Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a Web Service to use a Fixed Port Number When Using the Visual Studio Development Server?

I have an asp.net website and a windows form application.

My Webservice's Location is : http://localhost:12312/MyWebSiteFolder/WSFile.asmx

Problem is : the port number keeps changing, if I reopen the solution, its going to change to something else:

http://localhost:11122/MyWebSiteFolder/WSFile.asmx

Is there a way so I won't have to update the location of the file in my windows form application everytime I reopen the website's solution?

like image 910
Or Betzalel Avatar asked Dec 13 '22 13:12

Or Betzalel


1 Answers

(assuming Visual Studio 2010)

Under the Web tab of the properties for the project, change the "Auto-assign Port" option to "Specific port" and enter the port you want to always use. enter image description here

Alternately, if possible, you can choose the option to use your local IIS server.

Update:

If you're using a "Web Site" project instead of "Web Application," the setting is located in the properties window of the project instead of the properties dialog. Note the "Use dynamic ports" option here: enter image description here

like image 143
Jacob Avatar answered Apr 27 '23 14:04

Jacob