【问题标题】:An unhandled exception of type 'System.StackOverflowException' occurred in System.Web.dllSystem.Web.dll 中出现“System.StackOverflowException”类型的未处理异常
【发布时间】:2014-06-22 00:53:47
【问题描述】:
      <div class="head">
         @{Html.RenderAction("Top_Head", "My_PartialView");}
      </div>

      <div class="content">
                <div class="content-left">
                        <div class="ad">
                            <img src="~/Images/ImageFontEnd/ad.jpg" />

                        </div>

                    @RenderBody()


                 </div><!--END Content-left-->

              <div class="content-right">
                    <div class="##-lhe-support-login-sp" id="lien-he">
                     <div class="label-238px-box"></div>
                        <img src="~/Images/ImageFontEnd/call-pic.jpg" />
                    </div>
                 @{Html.RenderAction("Search_Price", "My_PartialView");}

2.created My_Partialview

using System;

namespace shopclothes.Controllers
{
    public class My_PartialviewController : Controller
    {
        shoponline1Entities db = new shoponline1Entities();
        // GET: /MyPartialView/

        #region[head]
         [ChildActionOnly]
        public ActionResult Top_Head()
        {

            return PartialView();
        }
        #endregion
     }
}

我遵循正确的语法?为什么会出现这样的问题?

【问题讨论】:

  • 您的 HTML 中可能有未闭合的标签,请验证。

标签: asp.net-mvc-4


【解决方案1】:

@RenderBody 应该用于布局视图,尝试删除它

【讨论】:

    【解决方案2】:

    错误: @{Html.RenderAction("Top_Head", "My_PartialView");} 和 @{Html.RenderAction("Search_Price", "My_PartialView");}

    【讨论】:

      【解决方案3】:

      在布局中同时使用@html.RenderAction 或@html.Action 似乎有一个错误。我建议您尝试以其他方式等效的renderaction 命令。更多帮助您可以查看this

      【讨论】:

        猜你喜欢
        • 2016-05-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多