Insufficient stack to continue executing the program safely. ASP.NET MVC 4 Insufficient stack to continue executing the program safely. ASP.NET MVC 4 asp.net asp.net

Insufficient stack to continue executing the program safely. ASP.NET MVC 4


Html.Action in master page calls the Search method with a POST request, so the framework won't call the action that returns the partial view but the other that returns a ViewResult with the master page. Same thing will happen again and you will be making recursive calls.

Simplest solution would be to rename the Search action that responds to POST request. Also make sure your form posts to this action but keep the same Html.Action call.

It seems like framework will still try to find the action that can respond to a POST request. Removing HttpGet attribute from Search action will solve this problem.


Its not seeing the your Partial view as a 'Partial View'. I had exactly the same problem but adding @{ Layout = null; }to the view ensures that the view is not seen as a normal view which loads the _Layout view.


The issue here is actually very simple - it should be

<li>@Url.Action("Search", "Search")</li>

instead of

<li>@Html.Action("Search", "Search")</li>

See Url vs Html - @Url will generate a string of a link, while @Html will try to generate the outcome of the action (which might lead to infinite loop)