繁体   English   中英

Html.Action - InsufficientExecutionStackException

[英]Html.Action - InsufficientExecutionStackException

当我使用@Html.Action("Index")InsufficientExecutionStackException是throw,为什么? 这是一个简单的mvc命令行。

@Html.Action正在执行指定的操作,并将该操作的结果作为字符串返回。

如果您正在重新渲染Index操作,然后重新渲染同一个视图,它就会四处转动。

如果您想要链接,请改用@Html.ActionLink("Index")

以下是这种情况的一个例子:

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

这是Razor代码:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM