我有一个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开发服务器什么时候?
发布评论