无法连接到sql server(使用EF) [英] can`t connect to the sql server(using EF)

查看:298
本文介绍了无法连接到sql server(使用EF)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试发布asp.net项目,但我无法连接到sql server(使用EF),因为连接字符串错误。这是



I am trying to publish asp.net project but i can`t connect to the sql server(using EF), because of the wrong connection string. Here it is

<add name="Entitiestak" connectionString="metadata=res://*/TAK.csdl|res://*/TAK.ssdl|res://*/TAK.msl;provider=System.Data.SqlClient;provider connection string="data source=67.100.145.152;initial catalog=LCD-TAK; User ID=***; Password=*****; integrated security=false;  MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />

推荐答案

你的连接应该像下一个例子:

< add name =SLOnlineShopEntitiesconnectionString =metadata = res://*/ShopModel.csdl | res://*/ShopModel.ssdl | res://*/ShopModel.msl; provider = System.Data.SqlClient; provider connection string =& quot; data source = 67.100.145.152; initial catalog = LCD-TAK; persist security info = True; user id = YourSqlLoginUser; password = YourSqlLoginPassword; multipleactiveresultsets = True; App = EntityFramework& quot; providerName =System.Data.EntityClient/>



您应该检查您的SQL Server,在与您的数据库关联的安全部分中确实有一个登录用户,其名称和密码与使用的SQL相同。 (您可以先尝试使用SQL身份验证和SQL登录用户登录SQL Management Studio。)
Your connection should be like in the next example:
<add name="SLOnlineShopEntities" connectionString="metadata=res://*/ShopModel.csdl|res://*/ShopModel.ssdl|res://*/ShopModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=67.100.145.152;initial catalog=LCD-TAK;persist security info=True;user id=YourSqlLoginUser;password=YourSqlLoginPassword;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

And you should check in your SQL Server, in the Security section associated with your database that you really have a "Login User" with name and password like in the used SQL. (You could try first to login in SQL Management Studio by using SQL Authentication and your SQL Login user.)


这篇关于无法连接到sql server(使用EF)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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