在Visual Studio 2013项目更改端口号 [英] Changing project port number in Visual Studio 2013

查看:748
本文介绍了在Visual Studio 2013项目更改端口号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改在Visual Studio 2013项目的端口号?

我使用ASP.Net,我需要同时在Visual Studio 2013的调试修改端口号。

How can I change the project port number in Visual Studio 2013 ?
I'm using ASP.Net and I need to change the port number while debugging in Visual Studio 2013.

推荐答案

有在VS二级项目类型ASP.NET项目:

There are two project types in VS for ASP.NET projects:

Web应用程序项目(其中主要是有一个.csproj的或.vbproj文件来存储这些设置)都在该项目下一个属性节点。在Web选项卡上,可以配置项目URL(假设IIS防爆preSS或IIS)来使用任何你想要的端口,只需点击创建虚拟目录按钮。这些设置保存到项目文件:

Web Application Projects (which notably have a .csproj or .vbproj file to store these settings) have a Properties node under the project. On the Web tab, you can configure the Project URL (assuming IIS Express or IIS) to use whatever port you want, and just click the Create Virtual Directory button. These settings are saved to the project file:

<ProjectExtensions>
  <VisualStudio>
    <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
      <WebProjectProperties>
       <DevelopmentServerPort>10531</DevelopmentServerPort>
       ...
     </WebProjectProperties>
    </FlavorProperties>
  </VisualStudio>
</ProjectExtensions>

网站项目是不同的。他们没有一个*凸出文件以存储设置。相反,设置在的文件中设置。在VS2013中,设置看起来像这样:

Web Site Projects are different. They don't have a .*proj file to store settings in; instead, the settings are set in the solution file. In VS2013, the settings look something like this:

Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebSite1(1)", "http://localhost:10528", "{401397AC-86F6-4661-A71B-67B4F8A3A92F}"
    ProjectSection(WebsiteProperties) = preProject
        UseIISExpress = "true"
        TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.5"
        ...
        SlnRelativePath = "..\..\WebSites\WebSite1\"
        DefaultWebSiteLanguage = "Visual Basic"
    EndProjectSection
EndProject

由于该项目由URL(包括口)确定,不存在在VS用户界面的方式来改变这一点。你应该可以,虽然修改解决方案文件,它应该工作。

Because the project is identified by the URL (including port), there isn't a way in the VS UI to change this. You should be able to modify the solution file though, and it should work.

这篇关于在Visual Studio 2013项目更改端口号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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