开发者

Deploy .NET web service in a concrete port

开发者 https://www.devze.com 2023-01-04 22:52 出处:网络
I would like to deploy or publish my开发者_StackOverflow .NET based web service always at the same port.

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

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

Thanks.


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消