C# Visual Web Developer (Express):为开发环境设置文档根目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21229/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-01 09:07:35  来源:igfitidea点击:

Visual Web Developer (Express): Setting Document Root for Dev Environment

提问by Brian Warshaw

I'm developing a site in Visual Web Dev Express, and when I run/debug, I'd like to be able to set my application's document root so that I can use safer paths, like "/css/style.css' instead of "css/style.css". How would I accomplish this?

我正在 Visual Web Dev Express 中开发一个站点,当我运行/调试时,我希望能够设置我的应用程序的文档根目录,以便我可以使用更安全的路径,例如“/css/style.css”的“css/style.css”。我将如何做到这一点?

采纳答案by nickd

  • Click on the web site node in the solution explorer.
  • Press F4 to see the properties window.
  • Change the virtual path from /projectnameto /
  • 单击解决方案资源管理器中的网站节点。
  • 按 F4 查看属性窗口。
  • 将虚拟路径从/projectname更改为/

Bear in mind that this has an impact on how you expect the application/web site to be deployed. If it is ever used outside the root of a web server, the URL paths will be incorrect.

请记住,这会影响您期望应用程序/网站的部署方式。如果它曾经在 Web 服务器的根目录之外使用,则 URL 路径将不正确。

回答by nickd

I have been looking for the virtual path field in the properties window but haven't been able to find it... it only shows me the following options

我一直在属性窗口中寻找虚拟路径字段,但一直找不到它...它只显示了以下选项

  • aperture directory URL
  • complete access route
  • policy file
  • port
  • use dynamic port
  • 光圈目录网址
  • 完整的访问路线
  • 策略文件
  • 港口
  • 使用动态端口

Do you know of some place else where I could find the Virtual Path field?

你知道还有什么地方可以让我找到 Virtual Path 字段吗?

回答by Rob-MakeSoftware

Select the "Web" tab and it's in the Servers section

选择“Web”选项卡,它位于“服务器”部分