Html.Action - InsufficientExecutionStackException [英] Html.Action - InsufficientExecutionStackException

查看:899
本文介绍了Html.Action - InsufficientExecutionStackException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 @ Html.Action(「指数」) InsufficientExecutionStackException 是罚球,为什么呢?它是一个简单的MVC的命令行。

When i use @Html.Action("Index") the InsufficientExecutionStackException is throw, why? it's a simple mvc command line.

推荐答案

的<一个href=\"http://msdn.microsoft.com/en-us/library/ee703457%28v=vs.108%29.aspx\"><$c$c>@Html.Action是执行指定的动作,并返回该动作作为字符串的结果。

The @Html.Action is executing the action specified and returning the result of that action as a string.

如果您正在重新渲染首页的行动,然后重新呈现此相同的观点,它只是兜兜转转。

If you are re-rendering the Index action that then re-renders this same view, its just going round and round and round.

如果你想有一个链接,请使用 @ Html.ActionLink(「指数」)代替。

If you want a link, use @Html.ActionLink("Index") instead.

下面是发生这种情况的一个例子:

Here is an example of this occurring:

public class HomeController : Controller
{
   public ViewResult Index()
   {
      return View();
   }
}

这是剃刀code:

And this is the Razor code:

<html>
<head>
   <title>Index</title>
</head>
<body>
    <!-- Causes an infinite loop; embedding the same action inside itself -->
    @Html.Action("Index")
</body>
</html>

这篇关于Html.Action - InsufficientExecutionStackException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆