Visual Studio ASP.NET MVC 项目:设置起始 URL

发布于 2024-08-16 13:38:08 字数 581 浏览 4 评论 0原文

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

输入我想要加载的 URL,在典型的 & 中有效格式,controller/action,VS 2010 给出了此异常。

alt text

尝试过的补救措施:

  • 以带或不带斜线开头的 URL 以
  • 带或不带斜线结尾的 URL斜杠

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

技术:

  • Visual Studio 2010
  • ASP.NET MVC 2

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

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.

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

alt text

Tried Remedies:

  • starting the URL with and without a slash
  • ending the URL with and without a slash

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

Technologies:

  • Visual Studio 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.

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

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

发布评论

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

评论(4

电影里的梦 2024-08-23 13:38:08

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

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

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

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.

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.

Here's the doc page on project start options.

合约呢 2024-08-23 13:38:08

使用起始页 \ 特定页面 - 非起始网址 - 并指定您的网址,不带斜杠。

那应该为你做。

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

That oughta do it for you.

眼趣 2024-08-23 13:38:08

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

在此处输入图像描述

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:

enter image description here

小傻瓜 2024-08-23 13:38:08

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

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.

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