I opened the Asp.Net Mvc 4. Internet application template. And I set the connection string for my database as follows:
<connectionStrings> <add name="DefaultConnection" connectionString="Data Source=ALI-PC\;Initial Catalog=OsosPlusDb;Persist Security Info=True;User ID=sa;Password=sa;" providerName="System.Data.SqlClient" /> </connectionStrings>
I started the project, click the registration button. I created a new user as follows:

When I click register to publish, I get this error:

But it creates a new user in the database and does not create member_user (the Membership table does not contain the user information added):

I can not find what the problem is. Sometimes an error does not occur.
UPDATE
And a snapshot:

AcoountModel:
public class UsersContext : DbContext { public UsersContext() : base("DefaultConnection") { } public DbSet<UserProfile> UserProfiles { get; set; } } [Table("UserProfile")] public class UserProfile { [Key] [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] public int UserId { get; set; } public string UserName { get; set; } }
InitializeSimpleMembershipAttribute.cs
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public sealed class InitializeSimpleMembershipAttribute : ActionFilterAttribute { private static SimpleMembershipInitializer _initializer; private static object _initializerLock = new object(); private static bool _isInitialized; public override void OnActionExecuting(ActionExecutingContext filterContext) {
LAST EDIT AND SUMMARY
The problem is the symbol ("i"). If I do not use "i", everything is fine. But when I use it, I got this error. How can I fix this problem.
source share