【发布时间】:2011-11-02 18:24:59
【问题描述】:
我在 Visual Studio 2010(框架 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:身份验证模式为“无”,我已尝试使用“表单”但仍无法正常工作。
【问题讨论】:
标签: web-services oracle .net-4.0 membership