MVC4,PostgreSQL,pgProvider,错误:“Membership.Provider”属性必须是“ExtendedMembershipProvider”的实例

时间:2014-08-12 21:46:07

标签: asp.net-mvc oauth membership-provider npgsql

我使用MVC4,postgres 9.2,Npgsql和pgProvider作为会员提供者。当我使用OAuth登录时,它会抛出下一个错误:

To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".

Source Error:

Line 144:            if (OAuthWebSecurity.Login(result.Provider, result.ProviderUserId, createPersistentCookie: false))
Line 145:            {


Source File: c:\VS\Web\Controllers\AccountController.cs    Line: 144 

和我的Web.config配置:

<membership defaultProvider="pgMembershipProvider">
  <providers>
    <clear />
    <add name="pgMembershipProvider" type="pgProvider.pgMembershipProvider, pgProvider" applicationName="pgProvider.Tests"/>
  </providers>
</membership>

<roleManager defaultProvider="pgRoleProvider">
  <providers>
    <clear />
    <add name="pgRoleProvider" type="pgProvider.pgRoleProvider, pgProvider" applicationName="pgProvider.Tests"/>
  </providers>
</roleManager>

我将copy local true设置为WebMatrix,因为其他线程1建议但不起作用。

也许pgProvider不支持ExtendedMembershipProvider,但我没有看到任何使用OAuth和Postgres的替代方法。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

我找到了Jon Galloway的这个链接,不可能将SimpleMembership与旧的会员提供者一起工作。