Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 错误:已添加具有相同密钥的项_Asp.net_Asp.net Mvc 3 - Fatal编程技术网

Asp.net 错误:已添加具有相同密钥的项

Asp.net 错误:已添加具有相同密钥的项,asp.net,asp.net-mvc-3,Asp.net,Asp.net Mvc 3,在我的应用程序中,我有一个视图,它正在渲染许多局部视图 每当我添加一个特定视图(如a.ascx)并尝试提交表单时,我就会出现以下错误: 已添加具有相同密钥的项 控件没有传递给action方法,因为我在那里添加了一个断点,从视图本身获取错误 检查了相应的模型,但未发现重复的属性或方法 详情如下: 2016-08-25 13:30:11.9250 - Error in Path :/SaveNewPSa Raw Url :/SaveNewPSa Message :An item with the

在我的应用程序中,我有一个视图,它正在渲染许多局部视图

每当我添加一个特定视图(如a.ascx)并尝试提交表单时,我就会出现以下错误:

已添加具有相同密钥的项

控件没有传递给action方法,因为我在那里添加了一个断点,从视图本身获取错误

检查了相应的模型,但未发现重复的属性或方法

详情如下:

2016-08-25 13:30:11.9250 - 
Error in Path :/SaveNewPSa
Raw Url :/SaveNewPSa
Message :An item with the same key has already been added.
Source :mscorlib
Stack Trace :   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey](IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)
   at System.Web.Mvc.ModelBindingContext.get_PropertyMetadata()
   at System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor)
   at System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext)
   at System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model)
   at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
   at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
   at System.Web.Mvc.DefaultModelBinder.UpdateCollection(ControllerContext controllerContext, ModelBindingContext bindingContext, Type elementType)
   at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
   at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
   at System.Web.Mvc.DefaultModelBinder.GetPropertyValue(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor, IModelBinder propertyBinder)
   at System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor)
   at System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext)
   at System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model)
   at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
   at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
   at System.Web.Mvc.DefaultModelBinder.GetPropertyValue(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor, IModelBinder propertyBinder)
   at System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor)
   at System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext)
   at System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model)
   at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
   at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
   at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor)
   at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
   at System.Web.Mvc.Controller.ExecuteCore()
   at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
   at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
   at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
   at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d()
   at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f)
   at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action)
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
TargetSite :Void ThrowArgumentException(System.ExceptionResource)
2016-08-2513:30:11.9250-
路径错误:/SaveNewPSa
原始Url:/SaveNewPSa
消息:已添加具有相同密钥的项。
资料来源:mscorlib
堆栈跟踪:位于System.ThrowHelper.ThrowArgumentException(异常资源)
at System.Collections.Generic.Dictionary`2.Insert(TKey键、TValue值、布尔加法)
在System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1源,Func`2键选择器,Func`2元素选择器,IEqualityComparer`1比较器)
在System.Linq.Enumerable.ToDictionary[TSource,TKey](IEnumerable`1源,Func`2键选择器,IEqualityComparer`1比较器)
在System.Web.Mvc.ModelBindingContext.get_PropertyMetadata()上
位于System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext ControllerContext、ModelBindingContext bindingContext、PropertyDescriptor PropertyDescriptor)
位于System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext ControllerContext,ModelBindingContext bindingContext)
位于System.Web.Mvc.DefaultModelBinder.BindCompleteXelementalModel(ControllerContext ControllerContext,ModelBindingContext bindingContext,Object model)
位于System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext ControllerContext,ModelBindingContext bindingContext)
位于System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext ControllerContext,ModelBindingContext bindingContext)
位于System.Web.Mvc.DefaultModelBinder.UpdateCollection(ControllerContext ControllerContext,ModelBindingContext bindingContext,Type elementType)
位于System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext ControllerContext,ModelBindingContext bindingContext)
位于System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext ControllerContext,ModelBindingContext bindingContext)
位于System.Web.Mvc.DefaultModelBinder.GetPropertyValue(ControllerContext ControllerContext、ModelBindingContext bindingContext、PropertyDescriptor PropertyDescriptor、IModelBinder propertyBinder)
位于System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext ControllerContext、ModelBindingContext bindingContext、PropertyDescriptor PropertyDescriptor)
位于System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext ControllerContext,ModelBindingContext bindingContext)
位于System.Web.Mvc.DefaultModelBinder.BindCompleteXelementalModel(ControllerContext ControllerContext,ModelBindingContext bindingContext,Object model)
位于System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext ControllerContext,ModelBindingContext bindingContext)
位于System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext ControllerContext,ModelBindingContext bindingContext)
位于System.Web.Mvc.DefaultModelBinder.GetPropertyValue(ControllerContext ControllerContext、ModelBindingContext bindingContext、PropertyDescriptor PropertyDescriptor、IModelBinder propertyBinder)
位于System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext ControllerContext、ModelBindingContext bindingContext、PropertyDescriptor PropertyDescriptor)
位于System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext ControllerContext,ModelBindingContext bindingContext)
位于System.Web.Mvc.DefaultModelBinder.BindCompleteXelementalModel(ControllerContext ControllerContext,ModelBindingContext bindingContext,Object model)
位于System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext ControllerContext,ModelBindingContext bindingContext)
位于System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext ControllerContext,ModelBindingContext bindingContext)
位于System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext ControllerContext,ParameterDescriptor ParameterDescriptor)
位于System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext ControllerContext,ActionDescriptor ActionDescriptor)
位于System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext ControllerContext,String actionName)
在System.Web.Mvc.Controller.ExecuteCore()上
在System.Web.Mvc.ControllerBase.Execute(RequestContext-RequestContext)中
位于System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext RequestContext)
在System.Web.Mvc.MvcHandler.c_uuudisplayClass6.c_uudisplayClassB.b_uu5()中
在System.Web.Mvc.Async.AsyncResultRapper.c__DisplayClass1.b__0()中
在System.Web.Mvc.Async.AsyncResultRapper.c_uuu显示类8`1.b_uuu7(IAsyncResult)
位于System.Web.Mvc.Async.AsyncResultRapper.WrappedAsyncResult`1.End()
在System.Web.Mvc.MvcHandler.c_udisplayClasse.b_ud()中
在System.Web.Mvc.SecurityUtil.b_0(操作f)
位于System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(操作)
位于System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
在System.Web.Mvc.MvcHandler.System.Web.IHTTPassynchandler.EndProcessRequest中(IAsyncResult结果)
在System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()中
在System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值&同步完成)
TargetSite:Void ThrowArgumentException(系统异常资源)

传递给视图的模型有一个字典。 看起来您正在尝试将多个具有相同键的项添加到此词典

您需要显示更多的代码,以便我们确定确切的问题,但我很确定您只是在添加