asp.net-mvc Visual Studio ASP.NET MVC 项目:设置起始 URL

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1982081/
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-09-08 00:00:36  来源:igfitidea点击:

Visual Studio ASP.NET MVC project: setting the start URL

asp.net-mvcvisual-studiovisual-studio-2010cassini

提问by p.campbell

Consider an ASP.NET MVC 2 project with VS 2010. The goal is to set the 'start URL' on run/debug using VS's built-in Cassini web server.

考虑使用 VS 2010 的 ASP.NET MVC 2 项目。目标是使用 VS 的内置 Cassini Web 服务器在运行/调试时设置“起始 URL”。

Entering the URL as I want to be loaded, in the typical & valid format, controller/action, VS 2010 gives this exception.

输入我想要加载的 URL,以典型且有效的格式controller/action,VS 2010 给出了这个例外。

alt text

替代文字

Tried Remedies:

尝试的补救措施:

  • starting the URL with and without a slash
  • ending the URL with and without a slash
  • 带和不带斜杠的 URL 开头
  • 使用和不使用斜杠结束 URL

Question:How can you specify the start URL for an MVC 2 project?

问题:如何为 MVC 2 项目指定起始 URL?

Technologies:

技术:

  • Visual Studio 2010
  • ASP.NET MVC 2
  • 视觉工作室 2010
  • ASP.NET MVC 2

Resolution:I was using the wrong field in the startup options. What was needed was the "Specific Page" field with the relative URL, and not Start URL.

解决方案:我在启动选项中使用了错误的字段。需要的是带有相对 URL的“特定页面”字段,而不是起始 URL。

采纳答案by womp

Start URL has to be a fully qualified URL and is not really used that often. It's meant for testing web services by opening a page that will call into the service, but isn't part of the application itself.

起始 URL 必须是完全限定的 URL,并且不经常使用。它旨在通过打开一个页面来测试 Web 服务,该页面将调用服务,但不是应用程序本身的一部分。

If you're just looking to start on a certain page of your application, which it sounds like you want, then use the "Specific Page" field, and enter your relative URL.

如果您只是想从应用程序的某个页面开始,这听起来像是您想要的,那么请使用“特定页面”字段,然后输入您的相对 URL。

Here's the doc page on project start options.

这是关于项目启动选项的文档页面。

回答by chakrit

Use Start Page\ Specific Page-- NOT START URL-- and specify your URL withouta slash.

使用Start Page\ Specific Page-- NOT START URL-- 并指定带斜杠的 URL 。

That oughta do it for you.

那应该为你做。

回答by Chris Halcrow

I was looking for a similar solution for VS2015. If anyone is reading this and you just want to run/debug via Visual Studio 2015 without having to attach to process and you're happy to run through Local IIS instead of Cassini or IIS Express, you can set a config like this:

我正在为 VS2015 寻找类似的解决方案。如果有人正在阅读本文,并且您只想通过 Visual Studio 2015 运行/调试而不必附加到进程,并且您很高兴通过本地 IIS 而不是 Cassini 或 IIS Express 运行,您可以设置如下配置:

enter image description here

在此处输入图片说明

回答by Bara

I have just removed the files with .user extension in my web project and the solution map and the problem is solved now. Try to close your solution in Visual Studio and take a backup of files you "remove"first.

我刚刚在我的 web 项目和解决方案图中删除了带有 .user 扩展名的文件,现在问题解决了。尝试在 Visual Studio 中关闭您的解决方案,并首先备份您“删除”的文件。