Problem with AspNetPgSqlMembershipProvider in PostgreSQL

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
TonyV
Posts: 74
Joined: Wed 25 May 2011 15:03

Problem with AspNetPgSqlMembershipProvider in PostgreSQL

Post by TonyV » Wed 27 Jul 2011 00:20

I'm building a WPF application using .NET Framework 4.0, Visual Studio 2010, and the latest version of the dotConnect library. I'm using PostgreSQL 9.04 as the database for the application.

I added the section to my app.config and included all of the lines from the documentation for the provider. I added the tables for the provider into my database in a schema called security.

Everything builds fine, but I'm getting a TypeLoadException with this message: Could not load type 'Devart.Data.PostgreSql.Web.Providers.PgSqlMembershipProvider' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Here is an excerpt from my app.config:

Code: Select all

    
    
        
            
            
        
    
        
            
                
                    
                    
                
            
            
                
                    
                    
                
            
        
    
I have a reference to the Devart.Data.PostgreSql.Web.dll in the applicaton project and, as I said, all builds fine. Why can't System.Web load the Devart.Data.PostgreSql.Web.Providers.PgSqlMembershipProvider type?

Can someone tell me what is wrong?

Thanks

Tony

TonyV
Posts: 74
Joined: Wed 25 May 2011 15:03

I figured this out

Post by TonyV » Wed 27 Jul 2011 02:21

There were two problems with my configuration:

First, in the app.config file, in the tag in the section, I had to add the name of the Devart.Data.PostgreSql.Web.dll file, without the extension to the type attribute, separated by the fully qualified type name by a comma.

Second, I had to add the Devart.Data.PostgreSql.Web.dll file to the project and set its properties so it is always copied to the output directory.

The upshot is that in the first case, System.Web did not know what DLL had the class that was being referenced, and in the second, it couldn't find that DLL, even though it is in the GAC on my machine.

Tony

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

Post by Shalex » Wed 27 Jul 2011 06:47

TonyV wrote:The upshot is that in the first case, System.Web did not know what DLL had the class that was being referenced, and in the second, it couldn't find that DLL, even though it is in the GAC on my machine.
This issue was discussed at http://www.devart.com/forums/viewtopic.php?t=18883.

TonyV
Posts: 74
Joined: Wed 25 May 2011 15:03

New issue has arisen

Post by TonyV » Wed 27 Jul 2011 13:21

Shalex:

First, thanks for replying. When I got everything working, it was 10 pm our time and I was at home. I couldn't log in as my home machine does not have any data in its database, but I felt comfortable calling it a night until I came into the office this morning.

Well, I'm in the office & those issues are resolved, but now I'm getting a different error:

Code: Select all

System.Configuration.ConfigurationErrorsException was caught
  Message=An error occurred creating the configuration section handler for system.web/membership: That assembly does not allow partially trusted callers. (C:\ElsagTFS\EOC4\Client UI\CarSystem\bin\Debug\CarSystem.vshost.exe.Config line 21)
  Source=System.Configuration
  BareMessage=An error occurred creating the configuration section handler for system.web/membership: That assembly does not allow partially trusted callers.
  Filename=C:\ElsagTFS\EOC4\Client UI\CarSystem\bin\Debug\CarSystem.vshost.exe.Config
  Line=21
I have checked the project folders and I have full control over all of them and all of the files in them. I don't understand where the error is coming from. Can you help?

Thanks

Tony

TonyV
Posts: 74
Joined: Wed 25 May 2011 15:03

New issue has been resolved

Post by TonyV » Wed 27 Jul 2011 14:14

I did some Google searches and I finally found a thread on another forum (not PostgreSql or Sevart related) that gave the answer. I had to add the following line to the section to prevent the error:
Tony

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

Post by Shalex » Thu 28 Jul 2011 15:05

Glad to hear that the issue is solved.

When dotConnect for PostgreSQL application is used in partially trusted code (this is actual for web projects), it requires medium trust plus SocketPermission (deployment topic).
For more information about the medium trust level, please refer to http://msdn.microsoft.com/en-us/library/ms998341.aspx.

Post Reply