无法添加IdentityRole - InvalidRoleName

时间:2017-03-22 11:16:00

标签: asp.net-core asp.net-identity entity-framework-core asp.net-roles

我正在尝试在ASP .NET Core中创建一个身份角色。当我尝试创建角色时,我收到此错误消息并且未插入值。

输出:

Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 POST http://localhost:4313/Admin/Roles/Create application/x-www-form-urlencoded; charset=UTF-8 182
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executing action method AuditLab.Web.Areas.Admin.Controllers.RolesController.Create (AuditLab.Web) with arguments () - ModelState is Valid
I am here
Microsoft.AspNetCore.Identity.RoleManager:Warning: Role 1d7d78bf-963a-4275-ab67-f9b62342bd78 validation failed: InvalidRoleName.
Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor:Information: Executing ViewResult, running view at path /Areas/Admin/Views/Roles/Create.cshtml.
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action AuditLab.Web.Areas.Admin.Controllers.RolesController.Create (AuditLab.Web) in 11.845ms
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 18.4453ms 200 text/html; charset=utf-8

P.S:我在这里部分是验证操作是否正在运行

更新 我发现传递给控制器​​的值是空/ null。我在我的观点中使用这个。

@model string

0 个答案:

没有答案