我正在尝试使用Daniel Nauck创建的PostgreSQL Membership提供程序http://dev.nauck-it.de/projects/aspsqlprovider,用于ASP.NET Web应用程序(C#),并按照给定的配置说明进行了配置。
http://dev.nauck-it.de/projects/1/wiki/Install?version=11
我已经使用nuget安装了NpgSQL和Membership提供程序:
Install-Package Npgsql
Install-Package Nauck.PostgreSQLProvider
访问项目配置网站上的“安全”选项卡时,我收到以下错误:
当不在独立exe内运行时,必须指定exepath
我将给定的SQL成员表添加到了我的Postgres数据库中,并指定了连接字符串以及web.config文件中的给定配置。
web.config:
<configuration>
<connectionStrings>
<add name="PostgreSQL" connectionString="Server=localhost;Port=5432;Database=mydb;User Id=postgres;Password=mypassword;Encoding=UNICODE;Sslmode=Prefer;Pooling=true;" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<membership defaultProvider="PgMembershipProvider">
<providers>
<clear />
<add name="PgMembershipProvider" type="NauckIT.PostgreSQLProvider.PgMembershipProvider" connectionStringName="PostgreSQL" requiresUniqueEmail="true" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordFormat="Hashed" applicationName="AquilaWeb" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="PgRoleProvider" cacheRolesInCookie="true" cookieName=".AspNetRoles" cookiePath="/" cookieProtection="All" cookieRequireSSL="false" cookieSlidingExpiration="true" createPersistentCookie="false" cookieTimeout="30" maxCachedResults="25">
<providers>
<clear />
<add name="PgRoleProvider" type="NauckIT.PostgreSQLProvider.PgRoleProvider" connectionStringName="PostgreSQL" applicationName="AquilaWeb" />
</providers>
</roleManager>
<profile enabled="true" defaultProvider="PgProfileProvider">
<providers>
<clear />
<add name="PgProfileProvider" type="NauckIT.PostgreSQLProvider.PgProfileProvider" connectionStringName="PostgreSQL" applicationName="AquilaWeb" />
</providers>
<properties>
<add name="FirstName" />
<add name="LastName" />
</properties>
</profile>
<sessionState mode="Custom" customProvider="PgSessionStateStoreProvider">
<providers>
<clear/>
<add name="PgSessionStateStoreProvider" type="NauckIT.PostgreSQLProvider.PgSessionStateStoreProvider" enableExpiredSessionAutoDeletion="true" expiredSessionAutoDeletionInterval="60000" enableSessionExpireCallback="false" connectionStringName="PostgreSQL" applicationName="AquilaWeb" />
</providers>
</sessionState>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Npgsql" publicKeyToken="5d8b90d52f46fda7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>