我使用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的替代方法。有什么建议吗?