NauckIT.PostgreSQLProvider 的问题

发布于 2024-12-07 06:52:18 字数 2305 浏览 2 评论 0原文

我对 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

九厘米的零° 2024-12-14 06:52:18

似乎 HttpContext.Current 可以为 null。 PgMembershipProvider 类检查它是否托管。根据答案,它会尝试使用 OpenExeConfiguration(对于独立版)或 OpenWebConfiguration (对于 Web 托管应用程序)。

由于在 Asp.Net 4.0 中,HttpContext.Current 有时可能为 null,因此会做出错误的决定,并从 Web 应用程序内调用 OpenExeConfiguration(大禁忌)。修复方法是将 PgMembershipProvider.Init 更改为使用以下检查:

Configuration cfg = HostingEnvironment.IsHosted ? 
    WebConfigurationManager.OpenWebConfiguration(HostingEnvironment.ApplicationVirtualPath) :
    ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

而不是 HttpContext.Current != null 检查。

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.

尸血腥色 2024-12-14 06:52:18

此错误已在 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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文