如何获得一个Web服务使用一个固定的端口号使用Visual Studio开发服务器什么时候?

编程入门 行业动态 更新时间:2024-10-27 03:40:45
本文介绍了如何获得一个Web服务使用一个固定的端口号使用Visual Studio开发服务器什么时候?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个asp网站和Windows窗体应用程序。

I have an asp website and a windows form application.

我的web服务的位置是:的http://本地主机:12312 / MyWebSiteFolder / WSFile.asmx

My Webservice's Location is : 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://本地主机:11122 / MyWebSiteFolder / WSFile.asmx

有没有办法,所以我不会有更新我的windows文件的位置形成应用程序每次我重新打开该网站的解决方案?

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?

推荐答案

(假设Visual Studio 2010中)

(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.

另外,如果可能的话,你可以选择使用本地IIS服务器的选项。

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

更新

如果您使用的是网站项目,而不是Web应用程序的设置位于属性的窗口的项目,而不是属性的对话框。请注意,使用动态端口选项的位置:

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:

更多推荐

如何获得一个Web服务使用一个固定的端口号使用Visual Studio开发服务器什么时候?

本文发布于:2023-08-07 10:42:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1318680.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:什么时候   如何获得   端口号   服务器   Visual

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!