0
我在Configuration.cs文件的種子方法如下代碼:的UserManager <ApplicationUser> .Create()的返回null
var userStore = new UserStore<ApplicationUser>();
var manager = new UserManager<ApplicationUser>(userStore);
IdentityResult result = manager.Create(new ApplicationUser() { UserName = "[email protected]", Email = "[email protected]", Name = "Martin Tracey" }, "password");
if (result.Succeeded) { Console.WriteLine("User created successfully"); }
else {
Console.WriteLine("Something went wrong. result is "+result.ToString());
foreach (var error in result.Errors) Console.WriteLine(error);
}
無論出於何種原因,manager.Create
調用返回null
。
任何想法爲什麼這個方法會返回null?