C# 承诺链无法处理MVC5中的拒绝

C# 承诺链无法处理MVC5中的拒绝,c#,json,validation,asp.net-mvc-5,runtime-error,C#,Json,Validation,Asp.net Mvc 5,Runtime Error,我有以下验证方法和关联的模型类。单击“创建”的“提交”按钮时,我的浏览器中出现上述错误(问题标题) 我如何解决特定问题 模范班 public class LsystemFamily { public int LsystemFamilyID { get; set; } [Display (Name = "Family Name")] [Remote("DuplicateFamilyName","LsystemFamilies",HttpMethod = "POST",Err

我有以下验证方法和关联的模型类。单击“创建”的“提交”按钮时,我的浏览器中出现上述错误(问题标题)

我如何解决特定问题

模范班

public class LsystemFamily
{
    public int LsystemFamilyID { get; set; }
    [Display (Name = "Family Name")]
    [Remote("DuplicateFamilyName","LsystemFamilies",HttpMethod = "POST",ErrorMessage= "System Family Name already Exists",AdditionalFields= "LsystemFamilyID")]
    //[Unique(ErrorMessage = "Family Name Already Exists")]
    public string FamilyName { get; set; }
验证方法

    public JsonResult DuplicateFamilyName(string FamilyName, int FamilyID)
    {
        //bool idExists = db.LsystemFamily.Any(id=>id.LsystemFamilyID.Equals(FamilyID));
        if (FamilyID == 0)
        {
            bool exists = db.LsystemFamily.Any(x => x.FamilyName == FamilyName);
            //var name = db.LsystemFamily.Where(x => x.FamilyName.Equals(FamilyName, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault();
            return Json(!exists,JsonRequestBehavior.AllowGet);
        }
        else
        {
            bool exists = db.LsystemFamily.Where(x => x.LsystemFamilyID != FamilyID).Any(x => x.FamilyName == FamilyName);
            //var name = db.LsystemFamily.Where(x => x.FamilyName.Equals(FamilyName, StringComparison.CurrentCultureIgnoreCase) && x.LsystemFamilyID != FamilyID).FirstOrDefault();
            return Json(!exists, JsonRequestBehavior.AllowGet);
        }
    }
之所以发布验证方法,是因为我只是在添加Json验证之后才开始出现错误

编辑:查看

<h2>Create</h2>
@using (Html.BeginForm()) 
{
@Html.AntiForgeryToken()

    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
    @Html.HiddenFor(model => model.LsystemFamilyID);

            @Html.LabelFor(model => model.FamilyName, htmlAttributes: new { @class = "control-label col-md-2" })
            @Html.EditorFor(model => model.FamilyName, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.FamilyName, "", new { @class = "text-danger" })

            @Html.LabelFor(model => model.DescriptionEN, htmlAttributes: new { @class = "control-label col-md-2" })
            @Html.EditorFor(model => model.DescriptionEN, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.DescriptionEN, "", new { @class = "text-danger" })


            @Html.LabelFor(model => model.DescriptionDE, htmlAttributes: new { @class = "control-label col-md-2" })
            @Html.EditorFor(model => model.DescriptionDE, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.DescriptionDE, "", new { @class = "text-danger" })

    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <input type="submit" value="Create" class="btn btn-default" />
        </div>
   </div>
@Html.ActionLink("Back to List", "Index")

@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
创建
@使用(Html.BeginForm())
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true,“,new{@class=“text danger”})
@Html.HiddenFor(model=>model.LsystemFamilyID);
@LabelFor(model=>model.FamilyName,htmlAttributes:new{@class=“controllabel col-md-2”})
@EditorFor(model=>model.FamilyName,new{htmlAttributes=new{@class=“form control”}})
@Html.ValidationMessageFor(model=>model.FamilyName,“,new{@class=“text danger”})
@LabelFor(model=>model.DescriptionEN,htmlAttributes:new{@class=“controllabel col-md-2”})
@EditorFor(model=>model.DescriptionEN,new{htmlAttributes=new{@class=“form control”}})
@Html.ValidationMessageFor(model=>model.DescriptionEN,“,new{@class=“text danger”})
@LabelFor(model=>model.DescriptionDE,htmlAttributes:new{@class=“controllabel col-md-2”})
@EditorFor(model=>model.DescriptionDE,new{htmlAttributes=new{@class=“form control”}})
@Html.ValidationMessageFor(model=>model.DescriptionDE,“,new{@class=“text danger”})
@ActionLink(“返回列表”、“索引”)
@节脚本{
@Scripts.Render(“~/bundles/jqueryval”)
}

缺少客户端代码脚本,以及提到的错误,请更新您的问题添加视图,错误是标题中提到的错误,更新了问题@WinterMute