Problems with NauckIT.PostgreSQLProvider
I have a problem with AspSQL Provider for PostgreSQL (http://dev.nauck-it.de/projects/aspsqlprovider).
When I try to create Roles with the ASP.NET Web Site Administration Tool this message keeps coming up:
There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.
The following message may help in diagnosing the problem: exePath must be specified when not running inside a stand alone exe. (D:\Documents\Programming\Projects\Portal\web.config line 40)
Here is the web.config section:
<membership defaultProvider="PgMembershipProvider">
<providers>
<clear />
<add name="PgMembershipProvider" type="NauckIT.PostgreSQLProvider.PgMembershipProvider" connectionStringName="db" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="bp" />
</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="db" applicationName="bp" />
</providers>
</roleManager>
<profile enabled="true" defaultProvider="PgProfileProvider">
<providers>
<clear />
<add name="PgProfileProvider" type="NauckIT.PostgreSQLProvider.PgProfileProvider" connectionStringName="db" applicationName="bp" />
</providers>
<properties>
<add name="FirstName" />
<add name="LastName" />
</properties>
</profile>
<sessionStat开发者_如何学JAVAe mode="Custom" customProvider="PgSessionStateStoreProvider">
<providers>
<clear />
<add name="PgSessionStateStoreProvider" type="NauckIT.PostgreSQLProvider.PgSessionStateStoreProvider" enableExpiredSessionAutoDeletion="true" expiredSessionAutoDeletionInterval="60000" enableSessionExpireCallback="false" connectionStringName="db" applicationName="bp" />
</providers>
</sessionState>
I followed the instruction Step By Step
Thanks in advance
Seems like HttpContext.Current
can be null. The PgMembershipProvider
class checks this to see if its hosted or not. Based on the answer, it attempts to either OpenExeConfiguration
(for stand-alone) or OpenWebConfiguration
for web hosted applications.
Since HttpContext.Current
can be null sometimes in Asp.Net 4.0, the wrong decision is made and the OpenExeConfiguration
is called from within a webapplication (big no-no). The fix is to change PgMembershipProvider.Init
to use the following check:
Configuration cfg = HostingEnvironment.IsHosted ?
WebConfigurationManager.OpenWebConfiguration(HostingEnvironment.ApplicationVirtualPath) :
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
instead of the HttpContext.Current != null
check.
this bug was fixed in the 2.0.0 Version of the Provider.
See http://dev.nauck-it.de/issues/131
You can download the latest release via NuGet: https://nuget.org/packages/NauckIT.PostgreSQLProvider/
精彩评论