NauckIT.PostgreSQLProvider 的问题
我对 PostgreSQL 的 AspSQL 提供程序 (http://dev.nauck-it.de/projects/aspsqlprovider) 有疑问。
当我尝试使用 ASP.NET 网站管理工具创建角色时,不断出现此消息:
您选择的数据存储存在问题。这可能是由无效的服务器名称或凭据或权限不足引起的。这也可能是由于未启用角色管理器功能引起的。单击下面的按钮将重定向到您可以选择新数据存储的页面。
以下消息可能有助于诊断问题:不在独立 exe 中运行时,必须指定 exePath。 (D:\Documents\Programming\Projects\Portal\web.config 第 40 行)
这是 web.config 部分:
<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>
<sessionState 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 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>
<sessionState 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
似乎
HttpContext.Current
可以为 null。PgMembershipProvider
类检查它是否托管。根据答案,它会尝试使用OpenExeConfiguration
(对于独立版)或OpenWebConfiguration
(对于 Web 托管应用程序)。由于在 Asp.Net 4.0 中,
HttpContext.Current
有时可能为 null,因此会做出错误的决定,并从 Web 应用程序内调用OpenExeConfiguration
(大禁忌)。修复方法是将PgMembershipProvider.Init
更改为使用以下检查:而不是
HttpContext.Current != null
检查。Seems like
HttpContext.Current
can be null. ThePgMembershipProvider
class checks this to see if its hosted or not. Based on the answer, it attempts to eitherOpenExeConfiguration
(for stand-alone) orOpenWebConfiguration
for web hosted applications.Since
HttpContext.Current
can be null sometimes in Asp.Net 4.0, the wrong decision is made and theOpenExeConfiguration
is called from within a webapplication (big no-no). The fix is to changePgMembershipProvider.Init
to use the following check:instead of the
HttpContext.Current != null
check.此错误已在 2.0.0 版本的 Provider 中修复。
参见http://dev.nauck-it.de/issues/131
即可下载通过 NuGet 发布的最新版本: https://nuget.org/packages/NauckIT.PostgreSQLProvider/
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/