使用WCF服务中的成员资格提供程序的连接字符串错误 [英] Connection string error using membership provider from WCF service

查看:92
本文介绍了使用WCF服务中的成员资格提供程序的连接字符串错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标是:我需要一个wcf方法,该方法将在数据库中创建用户.

The target is: I need a wcf method which will create user in the database.

我正在使用成员资格提供程序.而我的客户是SmartPhone/移动设备.

I am using membership provider. and My client is SmartPhone/mobile device.

我编写了一个方法,当我测试该方法时会遇到以下错误,该方法将创建用户BUT.

I wrote a method which will create user BUT when I test the method I get the following error.

错误:

尝试初始化System.Data.SqlClient.SqlConnection对象时发生错误.为连接字符串提供的值可能是错误的,或者可能包含无效的语法. 参数名称:connectionString

An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax. Parameter name: connectionString

我在以下行中收到此错误:

And I get this error in the following line:

Membership.CreateUser(name, password,email,"question","answer",true,out createStatus);

我正在使用与从数据库读取数据相同的connectionString.

I am using the same connectionString that I use to read data from the database.

我的连接字符串是:

<add name="MajangoEntities" connectionString="metadata=res://*/EntityModel.MajangoEntityModel.csdl|res://*/EntityModel.MajangoEntityModel.ssdl|res://*/EntityModel.MajangoEntityModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=tcp:sql2k298.discountasp.net;initial catalog=SQL2008R2_835021_myddb;user id=SQL2008R2_835021_mydb_user;password=mypassword;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

有人可以帮我一些想法吗?

Can anybody help me with some ideas??

推荐答案

该连接字符串包含一些特定于Entity Framework的数据.而是尝试仅嵌入其中的提供商连接字符串":

That connection string includes some Entity Framework specific data. Try instead just the "provider connection string" embedded within it:

 <add name="MajangoEntities" connectionString="data source=tcp:sql2k298.discountasp.net;initial catalog=SQL2008R2_835021_myddb;user id=SQL2008R2_835021_mydb_user;password=mypassword;multipleactiveresultsets=True;App=EntityFramework">

其中的其余数据(元数据等)只是使SQL Server感到困惑.

The rest of the data in there (the metadata, etc.) is just confusing SQL Server.

这篇关于使用WCF服务中的成员资格提供程序的连接字符串错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆