在具体端口中部署 .NET Web 服务

发布于 2024-09-06 13:39:56 字数 86 浏览 1 评论 0原文

我想始终在同一端口部署或发布基于 .NET 的 Web 服务。

我可以直接在我的代码中执行此操作(以编程方式说话)吗?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

心舞飞扬 2024-09-13 13:39:56

我认为更好的解决方案可能是编辑与 Web 服务相关的项目属性。在 Web 部分,您可以编辑要发布的具体端口。

另一种方法是编辑文件 .csproj。它看起来像一个 xml,您可以在其中找到并编辑以下几行:

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

就这么简单。

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.

寻找一个思念的角度 2024-09-13 13:39:56

端口是在 Web 服务器上定义的,因此您需要创建一个安装程序,始终使用该端口为其设置 Web 服务和 IIS 站点。

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.

烟火散人牵绊 2024-09-13 13:39:56

如果您使用 Casssini (asp.net WebServer),您可以在 c# 项目设置中每次更改设置使用相同的端口,如果您使用 IIS,可以在网站的 bingings 或主机标头中进行设置。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文