Exception when using dotconnect postgres with MVC4 and SimpleMembership

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
snielsson
Posts: 3
Joined: Thu 27 Sep 2012 10:47

Exception when using dotconnect postgres with MVC4 and SimpleMembership

Post by snielsson » 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 -->

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Exception when using dotconnect postgres with MVC4 and SimpleMembership

Post by Shalex » Thu 04 Oct 2012 10:43

dotConnect for PostgreSQL includes ASP.NET Membership provider: http://www.devart.com/dotconnect/postgr ... iders.html.
There is no support for SimpleMembership at the moment but we are investigating the possibility to add this feature to our provider. As a workaround, you can implement your own PgSqlSimpleMembership (inherited from WebMatrix.WebData.ExtendedMembershipProvider) as it was mentioned by stivoberlin in this thread: http://forums.devart.com/viewtopic.php?f=2&t=24826.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Exception when using dotconnect postgres with MVC4 and SimpleMembership

Post by Shalex » Fri 01 Mar 2013 10:05

New version of dotConnect for PostgreSQL 6.5 is released!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=3&t=26103. This version includes ExtendedMembership (SimpleMembership) provider support.

madve
Posts: 2
Joined: Sat 02 Mar 2013 20:14

Re: Exception when using dotconnect postgres with MVC4 and SimpleMembership

Post by madve » Sat 02 Mar 2013 20:19

Hi,

I started to develop a MVC 4 application based on PostgreSQL 9.2.

After installing dotConnect potgres 6.5 I got the following error in ASP.NET MVC 4 Application:

Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load type 'Devart.Data.PostgreSql.Web.Providers.PgSqlExtendedMembershipProvider' from assembly 'Devart.Data.PostgreSql.Web, Version=6.5.192.0, Culture=neutral, PublicKeyToken=09af7300eec23701'.

Source Error:


Line 259: requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
Line 260: minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" />
Line 261: <add name="PgSqlExtendedMembershipProvider" type="Devart.Data.PostgreSql.Web.Providers.PgSqlExtendedMembershipProvider, Devart.Data.PostgreSql.Web, Version=6.5.192.0, Culture=neutral, PublicKeyToken=09af7300eec23701"
Line 262: description="dotConnect for PostgreSQL extended membership provider"
Line 263: connectionStringName="PgSqlServices" useridcolumn="UserId" usernamecolumn="UserName"

Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config Line: 261

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034

Is it possible to download previous version? I'm using Visual Studio 2012 Professsional...

Thanks in advance!

Gabor Varga

madve
Posts: 2
Joined: Sat 02 Mar 2013 20:14

Re: Exception when using dotconnect postgres with MVC4 and SimpleMembership

Post by madve » Sat 02 Mar 2013 20:31

Hi,

I removed the trial edition, and installed the free edition, and the error is gone... Strange...

Best regards,

Gabor Varga

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Exception when using dotconnect postgres with MVC4 and SimpleMembership

Post by Shalex » Mon 04 Mar 2013 12:07

I removed the trial edition, and installed the free edition, and the error is gone... Strange...
The ExtendedMembership (SimpleMembership) provider support is available only in Professional (or Professional Trial) Edition of dotConnect for PostgreSQL.
After installing dotConnect potgres 6.5 I got the following error in ASP.NET MVC 4 Application:
...
Could not load type 'Devart.Data.PostgreSql.Web.Providers.PgSqlExtendedMembershipProvider'
Please follow the tutorial: http://www.devart.com/dotconnect/postgr ... orial.html.

Note: the PgSqlExtendedMembershipProvider and PgSqlExtendedRoleProvider classes are renamed to PostgreSqlExtendedMembershipProvider and PostgreSqlExtendedRoleProvider in the current build. We will fix this issue in the next public build. As a temporary workaround, please use the following configuration on the 5th step of the tutorial:

Code: Select all

<configuration>
  <connectionStrings>
    <remove name="PgSqlServices"/>
    <add name="PgSqlServices" connectionString="host=server;database=test;user id=postgres" providerName="Devart.Data.PostgreSql"/>
  </connectionStrings>
  <appSettings>
    <add key="enableSimpleMembership" value="false"/>
    <add key="autoFormsAuthentication" value="false"/>
  </appSettings>
  <system.web>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    <membership defaultProvider="PgSqlExtendedMembershipProvider">
      <providers>
        <remove name="PgSqlExtendedMembershipProvider" />
        <add name="PgSqlExtendedMembershipProvider" type="Devart.Data.PostgreSql.Web.Providers.PostgreSqlExtendedMembershipProvider, Devart.Data.PostgreSql.Web, Version=6.5.192.0, Culture=neutral, PublicKeyToken=09af7300eec23701"
          description="dotConnect for PostgreSQL extended membership provider"
          connectionStringName="PgSqlServices" useridcolumn="UserId" usernamecolumn="UserName"
          usertablename="UserProfile" />
      </providers>
    </membership>
    <roleManager enabled="true" defaultProvider="PgSqlExtendedRoleProvider">
      <providers>
        <remove name="PgSqlExtendedRoleProvider" />
        <add name="PgSqlExtendedRoleProvider" type="Devart.Data.PostgreSql.Web.Providers.PostgreSqlExtendedRoleProvider, Devart.Data.PostgreSql.Web, Version=6.5.192.0, Culture=neutral, PublicKeyToken=09af7300eec23701"
          description="dotConnect for PostgreSQL extended role provider"
          connectionStringName="PgSqlServices" useridcolumn="UserId" usernamecolumn="UserName"
          usertablename="UserProfile" />
      </providers>
    </roleManager>
  </system.web>
</configuration>

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Exception when using dotconnect postgres with MVC4 and SimpleMembership

Post by Shalex » Thu 14 Mar 2013 16:37

New build of dotConnect for PostgreSQL 6.5.202 is available!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=3&t=26197.

Post Reply