Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何设置实体框架';s连接字符串';s其他计算机的设置_C#_Mysql_Entity Framework 5_Connection String - Fatal编程技术网

C# 如何设置实体框架';s连接字符串';s其他计算机的设置

C# 如何设置实体框架';s连接字符串';s其他计算机的设置,c#,mysql,entity-framework-5,connection-string,C#,Mysql,Entity Framework 5,Connection String,我正在为一个拥有mysql服务器的客户开发一个程序。由于安全原因,我没有mysql服务器信息,因此我一直在mysql localhost上开发它 所以我发送了程序,我的客户更改了配置文件(myprogram.exe.config)中的连接字符串,但它不起作用。在安装了本地mysql并再次尝试之后,它也不起作用 我从未尝试过使用自定义连接字符串制作程序。。正如您所知,实体框架从db的表中创建类。我创建了数据库的脚本 我在寻找解决办法 这是我的配置文件 <section name="entit

我正在为一个拥有mysql服务器的客户开发一个程序。由于安全原因,我没有mysql服务器信息,因此我一直在mysql localhost上开发它

所以我发送了程序,我的客户更改了配置文件(myprogram.exe.config)中的连接字符串,但它不起作用。在安装了本地mysql并再次尝试之后,它也不起作用

我从未尝试过使用自定义连接字符串制作程序。。正如您所知,实体框架从db的表中创建类。我创建了数据库的脚本

我在寻找解决办法

这是我的配置文件

<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.
EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" requirePermission="false" />

 <connectionStrings>
<add name="XXXX.Properties.Settings.xxxConnectionString"connectionString= 
"server=localhost;User Id=root;password=*****;Persist Security Info=True;
database=xxx" providerName="MySql.Data.MySqlClient" />

<add name="xxxxEntity" connectionString="metadata=res://*/xxxxModel.csdl|res:
//*/xxxModel.ssdl|res://*/xxxModel.msl;provider=MySql.Data.MySqlClient;provider 
connection string=&quot;server=localhost;user id=root;password=*****;
persist security info=True;database=xxxx&quot;" providerName=
"System.Data.EntityClient" />
</connectionStrings>

我的客户就这样变了

<add name="TopluFatura.Properties.Settings.xxxxxConnectionString" 
connectionString="server=IP_ADDRESS;User Id=root;password=------;
Persist Security Info=True;database=xxxxx"providerName="MySql.Data.MySqlClient"/>
<add name="xxxxEntity" connectionString="metadata=res://*/xxxxModel.csdl|
res://*/xxxxModel.ssdl|res://*/xxxxModel.msl;provider=MySql.Data.MySqlClient;
provider connectionstring=&quot;server=IP_ADDRESS;user id=root;password=------;
persist security info=True;database=xxxx&quot;"
providerName="System.Data.EntityClient" />


更改新连接字符串时,您看到了什么错误?thanx作为答案,我们得到“应用程序已停止工作”此错误,并且没有任何信息..确定。尝试将EF构造函数(或使用connString的位置)放入Try/catch块中。只是想看看我们是否能够处理真正的错误消息;用户id=根用户;密码=*****;持久安全信息=True;database=xxxx,出现一个argumentexception,该关键字不受支持:“服务器”。哇。您正在使用正确的数据提供程序连接到MySql,对吗?看见