日期:2014-05-20  浏览次数:21407 次

(急求高手解决)异常详细信息: System.ArgumentException: 已添加了具有相同键的项。
已添加了具有相同键的项。 
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.ArgumentException: 已添加了具有相同键的项。

源错误: 

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

堆栈跟踪: 


[ArgumentException: 已添加了具有相同键的项。]
  System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +52
  System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +9383019
  System.Linq.Enumerable.ToDictionary(IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) +252
  System.Linq.Enumerable.ToDictionary(IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer) +91
  System.Web.Mvc.ModelBindingContext.get_PropertyMetadata() +228
  System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor) +392
  System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext) +147
  System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) +98
  System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +2501
  System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +548
  System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +474
  System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +181
  System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +830
  System.Web.Mvc.Controller.ExecuteCore() +136
  System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +111
  System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +39
  System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +65
  System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +44
  System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +42
  System.Web.Mvc.Async.WrappedAsyncResult`1.End() +141
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +54
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
  System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +52
  System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
  System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8836977
  System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

 


--------------------------------------------
版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.1 



aspx代码:
<h2>CreateRole</h2>
  <%Html.BeginForm("CreateRole", "System", FormMethod.Post, new { enctype = "multipart/form-data" }); %>
  <fieldset>
  <table>
  <tr>
  <td align="right" width="10%">  
  <label for="roleID">roleID:</label>
  </td>