oracle ASP会员奇数问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/651385/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 17:55:53  来源:igfitidea点击:

ASP Membership Odd Problem

asp.netsqloraclemembership

提问by DavidS

I am using the Membership API in ASP .NET and I have encountered the following problem on my staging server. The application works fine on my local machine. The data tables are stored on a SQL Server. Both my local and staging server point to the same DB server. When I deploy to my staging server I get the following error:

我在 ASP .NET 中使用 Membership API,并且在我的登台服务器上遇到了以下问题。该应用程序在我的本地机器上运行良好。数据表存储在 SQL Server 上。我的本地服务器和登台服务器都指向同一个数据库服务器。当我部署到我的登台服务器时,我收到以下错误:

 Parser Error Message: The connection name 'OraAspNetConString' was not 
 found in the applications configuration or the connection string is empty. 

    Line 135:    <roleManager>
    Line 136:      <providers>
    Line 137:        <add name="OracleRoleProvider" 

type="Oracle.Web.Security.OracleRoleProvider, Oracle.Web, Version=2.111.6.20,
Culture=neutral, PublicKeyToken=89b483f429c47342" 
connectionStringName="OraAspNetConString" applicationName="" />
    Line 138:        <add name="AspNetSqlRoleProvider"   
connectionStringName="LocalSqlServer" applicationName="/" 
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    Line 139:        <add name="AspNetWindowsTokenRoleProvider" 
applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, 
System.Web, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a" />


Source File: 
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config
    Line: 137 

I do not know why it is even trying to do anything with Oracle, my web.configdoes not contain anything associated with Oracle.

我不知道为什么它甚至试图用 Oracle 做任何事情,我的web.config不包含任何与 Oracle 相关的东西。

Does anyone have any insight into why this is happening?

有没有人对为什么会发生这种情况有任何见解?

[Edit]On my local machine's machine.config I do not have the OracleRoleProvider key. But my staging server does. If that helps.

[编辑]在我本地机器的 machine.config 上,我没有 OracleRoleProvider 键。但是我的登台服务器可以。如果那有帮助。

回答by nvuono

Old question here but I just ran into it and wanted to share some more details.

这里有一个老问题,但我刚遇到它并想分享更多细节。

First, the easiest solution if you need to do a <clear/>in your connectionStrings block is to add a blank OraAspNetConString connectionstring entry back into your web.config:

首先,如果您需要<clear/>在 connectionStrings 块中执行 a,最简单的解决方案是将一个空白的 OraAspNetConString 连接字符串条目添加回您的 web.config:

<connectionStrings>
    <clear />
      <add name="OraAspNetConString" connectionString=" "/>    
</connectionStrings>

What happens when you install the Oracle .NET packageon any of your machines is it installs a ton of different providers into your machine.config along with the OraAspNetConString as a machine-level connectionString. The <clear/>element gets rid of that OraAspNetConString and thanks to Oracle's machine.config additions all of the other Oracle providers loaded by default are crashing when they can't find the connectionString.

当您在任何机器上安装 Oracle .NET 包时会发生什么,它会在您的 machine.config 中安装大量不同的提供程序以及作为机器级 connectionString 的 OraAspNetConString。该<clear/>元素摆脱了 OraAspNetConString 并且由于 Oracle 的 machine.config 添加了默认加载的所有其他 Oracle 提供程序在找不到 connectionString 时崩溃。

The other answer here where you explored using the element for membership providers didn't work because most of the other oracle providers added in the machine.config are still going to be looking for that OraAspNetConStringso clearing just that one provider doesn't help you.

您在此处探索使用成员资格提供者元素的另一个答案不起作用,因为在 machine.config 中添加的大多数其他 oracle 提供者仍将寻找该OraAspNetConString,因此仅清除一个提供者对您没有帮助.

These are all the providers they installed into my machine.config:

这些是他们安装到我的 machine.config 中的所有提供程序:

<membership><providers>
    <add name="OracleMembershipProvider" type="Oracle.Web.Security.OracleMembershipProvider, Oracle.Web, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraAspNetConString" applicationName="" />
</providers></membership>
<profile><providers>
    <add name="OracleProfileProvider" type="Oracle.Web.Profile.OracleProfileProvider, Oracle.Web, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraAspNetConString" applicationName=""/>
</providers></profile>
<roleManager><providers>
    <add name="OracleRoleProvider" type="Oracle.Web.Security.OracleRoleProvider, Oracle.Web, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraAspNetConString" applicationName=""/>
</providers></roleManager>
<siteMap><providers>
    <add name="OracleSiteMapProvider" type="Oracle.Web.SiteMap.OracleSiteMapProvider, Oracle.Web, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraAspNetConString" applicationName="" securityTrimmingEnabled="true"/>
</providers></siteMap>
<webParts>
  <personalization>
    <providers>
      <add name="OraclePersonalizationProvider" type="Oracle.Web.Personalization.OraclePersonalizationProvider, Oracle.Web, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraAspNetConString" applicationName=""/>
    </providers>
  </personalization>
</webParts>
<healthMonitoring><providers>
    <add name="OracleWebEventProvider" type="Oracle.Web.Management.OracleWebEventProvider, Oracle.Web, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraAspNetConString" buffer="true" bufferMode="OracleNotification"/>
</providers></healthMonitoring>

So if you didn't want to add the blank OraAspNetConString you'd have to make sure that you either <clear/>every one of the following Oracle Providers or go in and add a <remove name=x />element to each provider class like this:

因此,如果您不想添加空白的 OraAspNetConString,则必须确保您使用<clear/>以下每个 Oracle 提供程序,或者<remove name=x />像这样向每个提供程序类添加一个元素:

<membership><providers>
    <remove name="OracleMembershipProvider" />
</providers></membership>
<profile><providers>
    <remove name="OracleProfileProvider" />
</providers></profile>
<roleManager><providers>
    <remove name="OracleRoleProvider" />
</providers></roleManager>
<siteMap><providers>
    <remove name="OracleSiteMapProvider" />
</providers></siteMap>
<healthMonitoring><providers>
    <remove name="OracleWebEventProvider" />
</providers></healthMonitoring>

I never dealt with any siteMap or Health Monitoring code in my web app but I still had to manually add these <remove/>elements for the different providers in my web.config or something would crash looking for an OraAspNetConString connection string that wasn't there.

我从未在我的 web 应用程序中处理任何 siteMap 或健康监控代码,但我仍然必须<remove/>在我的 web.config 中为不同的提供者手动添加这些元素,否则在寻找不存在的 OraAspNetConString 连接字符串时会崩溃。

回答by JoshBerke

You need to define your own provider in your config file for example here is a membership provider:

你需要在你的配置文件中定义你自己的提供者,例如这里是一个会员提供者:

    <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
        <providers>
            <clear/>
            <add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MyConnection" applicationName="MyApp"/>
        </providers>
    </membership>

Basically this will remove all the providers defined at the system level, This is why we are clearing, then you define your new providers. If you need the providers at the system level you can define your own as the default, or in your app code specifically request your provider.

基本上这将删除在系统级别定义的所有提供者,这就是我们清除的原因,然后您定义新的提供者。如果您需要系统级别的提供者,您可以将自己定义为默认提供者,或者在您的应用程序代码中专门请求您的提供者。

回答by dtc

This error is saying you have that in the machine.conf not web.config.

这个错误是说你在 machine.conf 而不是 web.config 中有那个。

回答by Akhtar Hossain

Simply add an empty ConnectionString for "OraAspNetConString" worked for me

只需为对我有用的“OraAspNetConString”添加一个空的 ConnectionString

<connectionStrings>
    <clear />
    <add name="OraAspNetConString" connectionString=" "/>
    .................. your other connectionstrings goes here .....
</connectionStrings>