首页 新闻 会员 周边 捐助

求解 这个错误怎么解 急急急

-2
[已解决问题] 解决于 2018-01-23 16:22
“/”应用程序中的服务器错误。

传入字典的模型项的类型为“MongoDB.Driver.MongoCollectionImpl`1[CDSS.DataContext.Model.RuleClassify]”,但此字典需要类型“System.Collections.Generic.IEnumerable`1[CDSS.DataContext.Model.RuleClassify]”的模型项。 
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.InvalidOperationException: 传入字典的模型项的类型为“MongoDB.Driver.MongoCollectionImpl`1[CDSS.DataContext.Model.RuleClassify]”,但此字典需要类型“System.Collections.Generic.IEnumerable`1[CDSS.DataContext.Model.RuleClassify]”的模型项。

源错误: 

执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 

堆栈跟踪: 


[InvalidOperationException: 传入字典的模型项的类型为“MongoDB.Driver.MongoCollectionImpl`1[CDSS.DataContext.Model.RuleClassify]”,但此字典需要类型“System.Collections.Generic.IEnumerable`1[CDSS.DataContext.Model.RuleClassify]”的模型项。]
   System.Web.Mvc.ViewDataDictionary`1.SetModel(Object value) +175
   System.Web.Mvc.ViewDataDictionary..ctor(ViewDataDictionary dictionary) +107
   System.Web.Mvc.WebViewPage`1.SetViewData(ViewDataDictionary viewData) +49
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +99
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +56
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +52
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +173
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9748493
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +159
xingcs的主页 xingcs | 初学一级 | 园豆:4
提问于:2018-01-22 13:23
< >
分享
最佳答案
0

错误提示说的很清楚了,程序需要你提供的是实现了IEnumerable的对象,但你提供的是MongoCollectionImpl。

奖励园豆:5
西漠以西 | 小虾三级 |园豆:1675 | 2018-01-22 14:39
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册