如何获得一个Web服务使用一个固定的端口号使用Visual Studio开发服务器什么时候? [英] How to get a Web Service to use a Fixed Port Number When Using the Visual Studio Development Server?

查看:606
本文介绍了如何获得一个Web服务使用一个固定的端口号使用Visual Studio开发服务器什么时候?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

My Webservice's Location is : http://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开发服务器什么时候?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆