问题描述
我创建了一个复制(粘贴右击复制&AMP)。当我尝试运行它,我得到以下错误:
I've created a copy(right-click Copy & Paste) of my Home page in a VS2013 ASP.NET MVC5 project and named it indexL10. When I try to run it, I get the following error:
说明: HTTP 404。您正在查找的资源(或之一其
依赖)可能已被删除,更名,或
暂时不可用。请检查以下URL并
确认其拼写正确。
请求的URL: /主页/ IndexL10
Requested URL: /Home/IndexL10
所以,我猜还有更多比复制和粘贴。我试着谷歌上搜索周围,但我没有找到答案,或搜索字符串,带我到一个用户的页面类似的问题。
没有人有任何意见/建议吗?谢谢
So, I'm guessing there's more to it than copying and pasting. I've tried googling around, but I've not found an answer, or search string that takes me to a page of a user with a similar problem.Does anyone have any ideas/suggestions? Thanks
推荐答案
*。CSHTML文件不像* .aspx文件。他们不直接暴露。的URL是由框架成路线翻译。该路由指向一个特定的控制器,并在该控制器中,然后由框架调用的特定动作。该行动将返回的ActionResult
,这在MVC通过一个最典型的是满足的ViewResult
。在该框架公约发挥作用,以寻找一个视图来呈现具有相同的名称作为被调用的行动,但这种要求不严格,可以覆盖。无论如何,图(您* .cshtml文件)通过利用由操作提供的数据剃刀渲染并返回给客户机的响应。
*.cshtml files are not like *.aspx files. They're not directly exposed. The URL is translated by the framework into a route. That route points to a particular controller and a particular action in that controller, which is then called by the framework. The action returns an ActionResult
, which in MVC is most typically satisfied via a ViewResult
. Conventions in the framework come into play to look for a view to render with the same name as the action that was called, but this is not strictly required and can be overridden. Regardless, the view (your *.cshtml file) is rendered by Razor utilizing data provided by the action and returned as a response to the client.
这篇关于运行.cshtml文件的副本给404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!