Asp.Net MVC 5 DataAnnotations EmailAddressAttribute System.OutOfMemoryException

时间:2014-12-17 10:14:13

标签: c# asp.net-mvc asp.net-mvc-5 out-of-memory data-annotations

我有一个奇怪的问题。我的应用程序在dev环境中工作得很好。当我在远程服务器(使用WebDeploy)中部署应用程序时,但是当我填写第一个表单时,我有这个错误:

  

2014-12-17 11:03:06,090 [13]致命 - System.OutOfMemoryException:Une   exception detype'System.OutOfMemoryException'aétélevée。一个   Go16(RegexRunner)à   System.Text.RegularExpressions.RegexRunner.Scan(正则表达式正则表达式,字符串   text,Int32 textbeg,Int32 textend,Int32 textstart,Int32 prevlen,   布尔快速,TimeSpan超时)à   System.Text.RegularExpressions.Regex.Run(Boolean quick,Int32 prevlen,   字符串输入,Int32开头,Int32长度,Int32 startat)à   System.Text.RegularExpressions.Regex.Match(String input)à   System.ComponentModel.DataAnnotations.EmailAddressAttribute.IsValid(对象   价值)à   System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(对象   value,ValidationContext validationContext)à   System.ComponentModel.DataAnnotations.ValidationAttribute.GetValidationResult(对象   value,ValidationContext validationContext)à   System.Web.Mvc.DataAnnotationsModelValidator.Validate(对象   容器)à   System.Web.Mvc.ModelValidator.CompositeModelValidator.d__1.MoveNext()   àSystem.Web.Mvc.DefaultModelBinder.OnModelUpdated(ControllerContext)   controllerContext,ModelBindingContext bindingContext)à   System.Web.Mvc.DefaultModelBinder.BindComplexModel(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.Async.AsyncControllerActionInvoker<> c__DisplayClass21.b__19(的AsyncCallback   asyncCallback,Object asyncState)

似乎是在模型验证期间,我的模型是:

public class UserCredentialsViewModel
{
    [Required(ErrorMessageResourceType = typeof(Resources.ValidationMessages), ErrorMessageResourceName = "EmailRequired", ErrorMessage = null)]
    [Display(Name = "Email", ResourceType = typeof(Resources.Labels))]
    [EmailAddress(ErrorMessageResourceType = typeof(Resources.ValidationMessages), ErrorMessageResourceName = "InvalidEmailFormat", ErrorMessage = null)]
    public string Email { get; set; }

    [Required(ErrorMessageResourceType = typeof(Resources.ValidationMessages), ErrorMessageResourceName = "PasswordRequired", ErrorMessage = null)]
    [DataType(DataType.Password)]
    [Display(Name = "Password", ResourceType = typeof(Resources.Labels))]
    public string Password { get; set; }
}

编辑:

我在IIS中重新启动我的网站并且没有错误,但我有一个新错误:

  

2014-12-17 11:27:34,163 [15]致命 - System.Web.HttpCompileException   (0x80004005):Un composant externe一个levé例外。一个   System.Web.Compilation.AssemblyBuilder.Compile()à   System.Web.Compilation.BuildProvidersCompiler.PerformBuild()à   System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath   virtualPath)à   System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath   virtualPath,Boolean noBuild,Boolean allowCrossApp,Boolean   allowBuildInPrecompile,Boolean throwIfNotFound,Boolean   ensureIsUpToDate)à   System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext的   context,VirtualPath virtualPath,Boolean noBuild,Boolean   allowCrossApp,Boolean allowBuildInPrecompile,Boolean   throwIfNotFound,Boolean ensureIsUpToDate)à   System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath   virtualPath,HttpContext context,Boolean allowCrossApp,Boolean   throwIfNotFound)à   System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath   virtualPath)à   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext   viewContext,TextWriter writer)à   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)   一个   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList的1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) à System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList 1   filters,Int32 filterIndex,ResultExecutingContext preContext,   ControllerContext controllerContext,ActionResult actionResult)à   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext   controllerContext,IList`1过滤器,ActionResult actionResult)à   System.Web.Mvc.Async.AsyncControllerActionInvoker<> c__DisplayClass21.b__1e(IAsyncResult的   asyncResult)

经过多次刷新后,错误消失了......我真的不明白......

0 个答案:

没有答案