如何解决将远程属性添加到asp.net核心时出错
当我将[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.")]
解决方法
已解决-安装Microsoft.AspNetCoreCore.Routing之后。 问题是在ASP核心项目中使用System.Web.Mvc
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。