当我将[Remote()]
属性添加到类属性时,抛出以下异常:
TypeLoadException:无法从程序集“ System.Web,版本= 4.0.0.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a”中加载类型“ System.Web.Routing.RouteValueDictionary”
using System;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace Entities
{
[Serializable]
public class EmployeeEntity
{
public int Id { get; set; }
[Required(ErrorMessage = "Required")]
[MaxLength(20)]
[RegularExpression(@"^\S*$", ErrorMessage = "No white space allowed")]
[Remote("IsUserNameAvailable", "Employee",HttpMethod ="GET", ErrorMessage = "EmailId already exists in database.")]
答案 0 :(得分:0)
已解决-安装Microsoft.AspNetCoreCore.Routing之后。 问题是在ASP核心项目中使用System.Web.Mvc