PostgreSQL + Npgsql连接器+ MVC和SimpleMembership不起作用

编程入门 行业动态 更新时间:2024-10-28 12:26:36
本文介绍了PostgreSQL + Npgsql连接器+ MVC和SimpleMembership不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经在没有网络安全性的情况下测试了数据库连接,并且可以正常工作。我已经阅读了Brice Lambson的教程 http: //brice-lambson.blogspot.es/2012/10/entity-framework-on-postgresql.html

I've test the db connection without Websecurity and it works. I've followed the tutorial from Brice Lambson brice-lambson.blogspot.es/2012/10/entity-framework-on-postgresql.html

但是当我使用

WebSecurity.InitializeDatabaseConnection( myContext, UserProfile, UserId, UserName,autoCreateTables:false);

WebSecurity.InitializeDatabaseConnection("myContext", "UserProfile", "UserId", "UserName", autoCreateTables: false);

我遇到此异常:

System.InvalidOperationException was caught HResult=-2146233079 Message=No user table found that has the name "UserProfile". Source=WebMatrix.WebData StackTrace: in WebMatrix.WebData.SimpleMembershipProvider.ValidateUserTable() in WebMatrix.WebData.WebSecurity.InitializeMembershipProvider(SimpleMembershipProvider simpleMembership, DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean createTables) in WebMatrix.WebData.WebSecurity.InitializeProviders(DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) in WebMatrix.WebData.WebSecurity.InitializeDatabaseConnection(String connectionStringName, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) in Glink.Filters.InitializeSimpleMembershipAttribute.SimpleMembershipInitializer..ctor() en c:\Users\...\InitializeSimpleMembershipAttribute.cs:line 46 InnerException: Npgsql.NpgsqlException HResult=-2147467259 Message=ERROR: 42601: Syntax error near «[» Source=Npgsql ErrorCode=-2147467259 BaseMessage=Syntax error near «[» Code=42601 Detail="" ErrorSql=SELECT [UserId] FROM [UserProfile] WHERE (UPPER([UserName]) = ((E'Z'))) File=src\backend\parser\scan.l Hint="" Line=1002 Position=8 Routine=scanner_yyerror Severity=ERROR Where="" StackTrace: in Npgsql.NpgsqlState.<ProcessBackendResponses_Ver_3>d__a.MoveNext() in Npgsql.ForwardsOnlyDataReader.GetNextResponseObject() in Npgsql.ForwardsOnlyDataReader.GetNextRowDescription() in Npgsql.ForwardsOnlyDataReader.NextResult() in Npgsql.ForwardsOnlyDataReader..ctor(IEnumerable`1 dataEnumeration, CommandBehavior behavior, NpgsqlCommand command, NotificationThreadBlock threadBlock, Boolean synchOnReadError) in Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb) in Npgsql.NpgsqlCommand.ExecuteScalar() in WebMatrix.Data.Database.QueryValue(String commandText, Object[] args) in WebMatrix.WebData.DatabaseWrapper.QueryValue(String commandText, Object[] parameters) in WebMatrix.WebData.SimpleMembershipProvider.GetUserId(IDatabase db, String userTableName, String userNameColumn, String userIdColumn, String userName) in WebMatrix.WebData.SimpleMembershipProvider.ValidateUserTable() InnerException:

NpgSql不准备与SimpleMerbership一起使用,但是我想知道你们中是否有人尝试过这种方法。 谢谢!

I guess that NpgSql could not be prepared to work with SimpleMerbership, but I'd like to know if any of you had tried this. Thank you!!

推荐答案

您应该尝试Daniel Nauck的AspSQLProvider: dev.nauck-it.de/projects/show/aspsqlprovider

You should try Daniel Nauck's AspSQLProvider: dev.nauck-it.de/projects/show/aspsqlprovider

它是ASP.NET 2.0+成员资格,角色,配置文件和会话状态存储提供程序的PostgreSQL实现。

It is a PostgreSQL implementation of the ASP.NET 2.0+ Membership, Role, Profile and Session-State Store Provider.

我希望对您有所帮助。

更多推荐

PostgreSQL + Npgsql连接器+ MVC和SimpleMembership不起作用

本文发布于:2023-10-23 23:17:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1522295.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连接器   不起作用   Npgsql   PostgreSQL   MVC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!