試圖使用Nustache共享客戶端和服務器鬍鬚模板,但Nustache只是不能很好地與我的應用程序一起玩。我直接從源代碼中的MVC應用程序示例中使用代碼,但每次嘗試設置或添加視圖引擎時都會出現錯誤。下面是一個代碼片段(來自一個操作方法,我也試着在Global.asax中添加全局視圖引擎,並有同樣的錯誤):Nustache查看引擎ArrayTypeMismatchException
ViewResult viewResult = View(new { test = "Jawesome" });
viewResult.ViewEngineCollection = new ViewEngineCollection
{
new NustacheViewEngine()
};
而這裏的錯誤:
[ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.]
System.Collections.Generic.List`1.Insert(Int32 index, T item) +62
MyController.Index() in C:\src\projects\myproject\myproject.Web\Controllers\MyController.cs:83
lambda_method(Closure , ControllerBase , Object[]) +79
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264
...
您是如何解決這個問題的? – 2012-03-03 15:24:08
這不是一個答案... – 2015-12-20 22:53:19