Oracle成员资格提供程序和框架4的问题

时间:2011-11-02 18:25:00

标签: web-services oracle .net-4.0 membership

我在Visual Studio 2010(Framework 4)中创建Web服务时遇到了严重问题。

无论如何,我必须使用Oracle成员资格提供程序(我已经安装了“Oracle Providers for ASP.NET 4 11.2.0.2.0”,它修改了框架的machine.config),但我无法连接到成员资格。

我在web.config中的代码如下:

<configuration>
<connectionStrings>
    <remove name="OraAspNetConString"></remove>
    <add name="OraAspNetConString" connectionString="User Id=USUARIO;Password=PASSWORD;Data Source=DATABASENAME;" providerName="Oracle.DataAcces.Client"/>
</connectionStrings>

<system.web>

<membership defaultProvider="OracleMembershipProvider" userIsOnlineTimeWindow="30"/>
<roleManager defaultProvider="OracleRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All"/>
    <authentication mode="None"/>
    <authorization>
        <allow users="*"/>
    </authorization>

我还将参考'System.Web.ApplicationServices'添加到我的项目中。

要测试与Oracle成员身份的连接,我已将此代码放在具有我的Web服务的OperationContract之一中:

 MembershipUserCollection userC = Membership.GetAllUsers();

 sample.StringValue += " - " + userC.Count;

 bool resp = Membership.ValidateUser(id, id2);

获取的MembershipUserCollection始终显示没有用户。 UserC.Count始终等于零。 参数'id'和'id2',用户名和密码分别用于验证(我知道这是一个很糟糕的用途),但总是返回false。

任何人都可以帮我这个吗?

非常感谢。

PD:身份验证模式为“无”,我尝试使用“表单”但仍无效。

1 个答案:

答案 0 :(得分:0)

问题解决了。

我需要将应用程序的名称(applicationName)放在成员资格和角色管理器提供程序的标签上(在文件machine.config中)。

: - )