Exception when using dotconnect postgres with MVC4 and SimpleMembership
Posted: Fri 28 Sep 2012 10:47
ok, I am trying to get dotConnect for Postgres up and running for a default ASP.NET MVC4 site (I really need some documentation about this).
Inside the InitializeSimpleMembershipAttribute this call is made:
WebSecurity.InitializeDatabaseConnection("MyDb", "UserProfile", "UserId", "UserName", autoCreateTables: true);
A database called GoDeal2 has been made in postgress and the connection string "MyDb" is this:
<add name="MyDb" connectionString="User ID=XXXX;Password=XXXX;Host=localhost;Port=5432;Database=GoDeal2;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;" providerName="Devart.Data.PostgreSql" />
I believe the connection string is ok, because before the exception occurs this call ((IObjectContextAdapter)context).ObjectContext.CreateDatabase(); succeeds and manages to create a new table, so there is connection to the db.
When this call is made:
WebSecurity.InitializeDatabaseConnection("MyDb", "UserProfile", "UserId", "UserName", autoCreateTables: true);
This exception occurs:
operator does not exist: information_schema.sql_identifier = integer
at Devart.Data.PostgreSql.s.e(af A_0)
at Devart.Data.PostgreSql.af.ah()
at Devart.Data.PostgreSql.PgSqlCommand.InternalPrepare(Boolean implicitPrepare, Int32 startRecord, Int32 maxRecords)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader()
at WebMatrix.Data.Database.<QueryInternal>d__0.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at WebMatrix.Data.Database.QuerySingle(String commandText, Object[] args)
at WebMatrix.WebData.DatabaseWrapper.QuerySingle(String commandText, Object[] parameters)
at WebMatrix.WebData.SimpleMembershipProvider.CheckTableExists(IDatabase db, String tableName)
at WebMatrix.WebData.SimpleMembershipProvider.CreateTablesIfNeeded()
at WebMatrix.WebData.WebSecurity.InitializeMembershipProvider(SimpleMembershipProvider simpleMembership, DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean createTables)
at WebMatrix.WebData.WebSecurity.InitializeProviders(DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables)
at WebMatrix.WebData.WebSecurity.InitializeDatabaseConnection(String connectionStringName, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables)
at GoDeal.Mvc4.Filters.InitializeSimpleMembershipAttribute.SimpleMembershipInitializer..ctor() in c:\youbit\youbit.biz\kunder\GoDeal\GoDealAdmin\GoDeal.Mvc4\Filters\InitializeSimpleMembershipAttribute.cs:line 41
What have I done wrong, or does dotConnect not support SimpleMembership ?
It looks as an error in dotConnect.
The relevant web.config settings ere:
<!-- MEMBERSHIP STUFF -->
<membership>
<providers>
<add name="GoDealMembershipProvider" type="Devart.Data.PostgreSql.Web.Providers.PgSqlMembershipProvider, Devart.Data.PostgreSql.Web, Version=6.2.77.0, Culture=neutral, PublicKeyToken=09af7300eec23701"
description="dotConnect for PostgreSQL membership provider" connectionStringName="MyDb"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"
requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" />
</providers>
</membership>
<profile>
<providers>
<add name="GoDealProfileProvider" type="Devart.Data.PostgreSql.Web.Providers.PgSqlProfileProvider, Devart.Data.PostgreSql.Web, Version=6.2.77.0, Culture=neutral, PublicKeyToken=09af7300eec23701"
description="dotConnect for PostgreSQL profile provider" connectionStringName="MyDb" />
</providers>
</profile>
<roleManager>
<providers>
<add name="GoDealRoleProvider" type="Devart.Data.PostgreSql.Web.Providers.PgSqlRoleProvider, Devart.Data.PostgreSql.Web, Version=6.2.77.0, Culture=neutral, PublicKeyToken=09af7300eec23701"
description="dotConnect for PostgreSQL role provider" connectionStringName="MyDb" />
</providers>
</roleManager> <!-- END OF MEMBERSHIP STUFF -->
Inside the InitializeSimpleMembershipAttribute this call is made:
WebSecurity.InitializeDatabaseConnection("MyDb", "UserProfile", "UserId", "UserName", autoCreateTables: true);
A database called GoDeal2 has been made in postgress and the connection string "MyDb" is this:
<add name="MyDb" connectionString="User ID=XXXX;Password=XXXX;Host=localhost;Port=5432;Database=GoDeal2;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;" providerName="Devart.Data.PostgreSql" />
I believe the connection string is ok, because before the exception occurs this call ((IObjectContextAdapter)context).ObjectContext.CreateDatabase(); succeeds and manages to create a new table, so there is connection to the db.
When this call is made:
WebSecurity.InitializeDatabaseConnection("MyDb", "UserProfile", "UserId", "UserName", autoCreateTables: true);
This exception occurs:
operator does not exist: information_schema.sql_identifier = integer
at Devart.Data.PostgreSql.s.e(af A_0)
at Devart.Data.PostgreSql.af.ah()
at Devart.Data.PostgreSql.PgSqlCommand.InternalPrepare(Boolean implicitPrepare, Int32 startRecord, Int32 maxRecords)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader()
at WebMatrix.Data.Database.<QueryInternal>d__0.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at WebMatrix.Data.Database.QuerySingle(String commandText, Object[] args)
at WebMatrix.WebData.DatabaseWrapper.QuerySingle(String commandText, Object[] parameters)
at WebMatrix.WebData.SimpleMembershipProvider.CheckTableExists(IDatabase db, String tableName)
at WebMatrix.WebData.SimpleMembershipProvider.CreateTablesIfNeeded()
at WebMatrix.WebData.WebSecurity.InitializeMembershipProvider(SimpleMembershipProvider simpleMembership, DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean createTables)
at WebMatrix.WebData.WebSecurity.InitializeProviders(DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables)
at WebMatrix.WebData.WebSecurity.InitializeDatabaseConnection(String connectionStringName, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables)
at GoDeal.Mvc4.Filters.InitializeSimpleMembershipAttribute.SimpleMembershipInitializer..ctor() in c:\youbit\youbit.biz\kunder\GoDeal\GoDealAdmin\GoDeal.Mvc4\Filters\InitializeSimpleMembershipAttribute.cs:line 41
What have I done wrong, or does dotConnect not support SimpleMembership ?
It looks as an error in dotConnect.
The relevant web.config settings ere:
<!-- MEMBERSHIP STUFF -->
<membership>
<providers>
<add name="GoDealMembershipProvider" type="Devart.Data.PostgreSql.Web.Providers.PgSqlMembershipProvider, Devart.Data.PostgreSql.Web, Version=6.2.77.0, Culture=neutral, PublicKeyToken=09af7300eec23701"
description="dotConnect for PostgreSQL membership provider" connectionStringName="MyDb"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"
requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" />
</providers>
</membership>
<profile>
<providers>
<add name="GoDealProfileProvider" type="Devart.Data.PostgreSql.Web.Providers.PgSqlProfileProvider, Devart.Data.PostgreSql.Web, Version=6.2.77.0, Culture=neutral, PublicKeyToken=09af7300eec23701"
description="dotConnect for PostgreSQL profile provider" connectionStringName="MyDb" />
</providers>
</profile>
<roleManager>
<providers>
<add name="GoDealRoleProvider" type="Devart.Data.PostgreSql.Web.Providers.PgSqlRoleProvider, Devart.Data.PostgreSql.Web, Version=6.2.77.0, Culture=neutral, PublicKeyToken=09af7300eec23701"
description="dotConnect for PostgreSQL role provider" connectionStringName="MyDb" />
</providers>
</roleManager> <!-- END OF MEMBERSHIP STUFF -->