使用网站项目在 Visual Studio Dev Server 上设置静态端口号

发布于 2024-07-26 18:35:32 字数 94 浏览 7 评论 0原文

我在 Visual Studio 2008 中有一个网站项目(不是 Web 应用程序项目!)

如何将 ASP.NET 开发启动端口设置为网站项目中的静态端口?

I have a WebSite project in Visual Studio 2008 (not a Web Application project!)

How do I set the ASP.NET Development startup port to a static port in a WebSite project?

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

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

发布评论

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

评论(4

止于盛夏 2024-08-02 18:35:32

为 ASP.NET 开发服务器指定端口 - WebSite/WebServices 项目

  1. 在“解决方案资源管理器”中,单击应用程序的名称。
  2. 在“属性”窗格中,单击使用旁边的向下箭头
    动态端口
    并选择 False
    下拉列表。 这将使
    编辑端口号属性。
  3. 在“属性”窗格中,单击“端口号”旁边的文本框并键入
    在端口号中。 单击外部
    属性窗格。这将保存属性设置。
  4. 每次运行文件系统时
    Visual Web Developer 中的网站 ASP.NET
    开发服务器将侦听指定的端口。

To specify a port for the ASP.NET Development Server - WebSite / WebServices projects

  1. In Solution Explorer, click the name of the application.
  2. In the Properties pane, click the down-arrow beside Use
    dynamic ports
    and select False from
    the dropdown list. This will enable
    editing of the Port number property.
  3. In the Properties pane, click the text box beside Port number and type
    in a port number. Click outside of
    the Properties pane.This saves the property settings.
  4. Each time you run a file-system
    Web site within Visual Web Developer, the ASP.NET
    Development Server will listen on the specified port.
揽清风入怀 2024-08-02 18:35:32

按 F4 打开属性窗格。 然后就可以获得 反斜杠17提到的选项

Press F4 to get the Properties Pane. And then one can get the option mentioned by Backslash17

亣腦蒛氧 2024-08-02 18:35:32

对于网站,无法从 VS 属性页界面分配端口,但如果您从命令行启动网站,则可以分配端口(如果您想调试网站,可以在启动后附加)网站)

WebDev.WebServer40.exe

路径为

“C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\”
或者
“C:\Program Files\Common Files\microsoft shared\DevServer\10.0\”

ASP.NET 开发服务器用法:
WebDev.WebServer40 /port: /path: [/vpath:]

示例:

WebDev.WebServer40 /port:8080 /path:"c:\inetpub\wwwroot\MyApp" /vpath:"/MyApp"

For web site assigning port is not possible form VS Properties Page interface but if you start your web site from command line then you can assign the port (If you want to debug the site you can attach after starting the web site)

WebDev.WebServer40.exe

path is

"C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\"
or
"C:\Program Files\Common Files\microsoft shared\DevServer\10.0\"

ASP.NET Development Server Usage:
WebDev.WebServer40 /port: /path: [/vpath:]

Example:

WebDev.WebServer40 /port:8080 /path:"c:\inetpub\wwwroot\MyApp" /vpath:"/MyApp"

棒棒糖 2024-08-02 18:35:32

网站项目无法做到这一点,端口号是随机分配的。

这只能通过 Web 应用程序项目来实现

It can't be done with a Website project, the port number is randomly assigned.

It's only possible with a Web App Project

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