在错误跟踪器中找到此错误。我如何找到确切的问题以及如何解决此异常?
一个或多个实体的验证失败。有关更多详细信息,请参见“ EntityValidationErrors”属性。
这是堆栈跟踪中的说明
服务器堆栈跟踪:
在System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(消息 回复,MessageFault错误,字符串操作,MessageVersion版本, FaultConverter faultConverter)位于 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime 操作,ProxyRpc&rpc)位于 System.ServiceModel.Channels.ServiceChannel.Call(字符串操作, 布尔型单向,ProxyOperationRuntime操作,Object [] ins, Object []超时,TimeSpan超时)在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作)在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 消息)
在[0]处抛出异常: System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg) System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,Int32类型)位于 UnifiedSelfServiceWebsite.UnifiedUserAccountService.IUserAccountService.RegisterUser(NewUserRegistrationRequest newUserRegistrationRequest,品牌商标) UnifiedSelfServiceWebsite.Controllers.AccountController.Register(RegisterViewModel 模型)在c:.... \ Controllers \ AccountController.cs:第221行 lambda_method(Closure,ControllerBase,Object [])在 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext,ActionDescriptor actionDescriptor,IDictionary
2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult
2.CallEndDelegate(IAsyncResult asyncResult) System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__11_0() 在 System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters。<> c__DisplayClass11_1.b__2() 在 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) System.Web.Mvc.Async.AsyncControllerActionInvoker。<> c__DisplayClass3_6.b__3() 在 System.Web.Mvc.Async.AsyncControllerActionInvoker。<> c__DisplayClass3_1.b__5(IAsyncResult asyncResult)
这是我的控制人:
public ActionResult Register(RegisterViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var verifyAccountViewModel = Session[Identifiers.Session.Account.VerifyModel] as VerifyAccountViewModel;
if (verifyAccountViewModel == null)
{
return RedirectToAction("Login");
}
var userAccountService = ServiceHelper.GetUserAccountService();
var newUserRegistration = new NewUserRegistrationRequest
{
FirstName = verifyAccountViewModel.FirstName,
LastName = verifyAccountViewModel.LastName,
ZipCode = verifyAccountViewModel.ZipCode,
PolicyNumber = verifyAccountViewModel.PolicyNumber,
MemberNumber =
verifyAccountViewModel.MemberNumber ?? 0,
UserName = model.UserName,
Password = model.Password,
ConfirmPassword = model.ConfirmPassword,
BirthDate = verifyAccountViewModel.BirthDate,
PrimaryPhoneNumber = verifyAccountViewModel.PhoneNumber,
SecurityQuestionAnswers = new List<SecurityQuestionAnswer>
{
new SecurityQuestionAnswer
{
SecurityQuestionId = model.SecurityQuestion1Id ?? 0,
Answer = model.SecurityQuestion1Answer
},
new SecurityQuestionAnswer
{
SecurityQuestionId = model.SecurityQuestion2Id ?? 0,
Answer = model.SecurityQuestion2Answer
}
}
};
var brand = Brand.MYSIte1;
if (ConfigurationManager.AppSettings["siteBrand"].ToString().ToUpper().Contains("GE")
brand = Brand.MYSITE2;
var registrationResult = userAccountService.RegisterUser(newUserRegistration, brand);
if (!registrationResult.Success)
{
var errorMessage = "Failed to complete the registration process due to an unknown error";
if (registrationResult.Messages != null && registrationResult.Messages.Count > 0)
{
errorMessage = registrationResult.Messages[0];
}
ModelState.AddModelError(string.Empty, errorMessage);
return View(model);
}
var authenticationResult = userAccountService.AuthenticateUser(model.UserName, model.Password);
if (!authenticationResult.Authenticated)
{
return RedirectToAction("Login");
}
CompleteLogin(authenticationResult, model.UserName, model.Password);
return RedirectToAction("Summary");
}