Francisco
Francisco

Reputation: 267

Deploy .NET web service in a concrete port

I would like to deploy or publish my .NET based web service always at the same port.

Can I do this directly in my code (programmatically talking)?

Thanks.

Upvotes: 0

Views: 519

Answers (3)

Iain
Iain

Reputation: 6472

If you are using Casssini (asp.net WebServer), you change the settings use the same port every time within the c# project settings, if you using IIS can set this in the bingings or host headers of the website.

Upvotes: 0

Francisco
Francisco

Reputation: 267

I think a better solution could be to edit the project propietries related to the web service. At the Web section you can edit the concrete port to publish.

Another way to do that is to edit the file .csproj. It looks like a xml where you can find and edit the following lines:

      <WebProjectProperties>
          <UseIIS>False</UseIIS>
          <AutoAssignPort>False</AutoAssignPort>
          <DevelopmentServerPort>1665</DevelopmentServerPort>
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
          <IISUrl>
          </IISUrl>
          <NTLMAuthentication>False</NTLMAuthentication>
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
      </WebProjectProperties>

As simple as that.

Upvotes: 1

Oded
Oded

Reputation: 499302

Ports are defined on the web server, so you need to create an installer that always sets the web services and the IIS site for them with that port.

Upvotes: 0

Related Questions