How to force a web service to use a fixed port number when using a Visual Studio development server?

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

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

The problem is that the port number continues to change, if I open the solution again, it will change to something else:

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

Is there a way, so I don’t need to update the file location in the application for the Windows form every time I open the solution for the website again?

+4
source share
2 answers

(assuming Visual Studio 2010)

On the "Web" tab of the project properties, change the "Auto-create port" to "Specific port" and enter the port that you want to always use. enter image description here

If possible, you can choose to use the local IIS server.

Update

If you use the Web site project instead of the Web application, this option is located in the project properties window instead of the properties dialog box. Check out the Use Dynamic Ports option here: enter image description here

+13
source

What your web application looks like in Explorer Solution - does it show: \ or does it show the name of your web application without a path. or shows http: ///

In case 1, you should see the properties. But you do not get it for the rest

0
source

All Articles