如何远程SQL Server 2008中使用MVC3 EF4连接 [英] How to connect to remotely SQL Server 2008 using MVC3 EF4
问题描述
我试图远程连接,我有我的MVC3下面的连接字符串首先使用EF4 CTP5 code
I'm trying to connect remotely and I have the following connection string on my MVC3 using EF4 ctp5 code first
<add name="ApplicationServicesX"
connectionString="provider=System.Data.SqlClient;provider connection string='Data Source=asc-svr2;
Initial Catalog=AdventureWorks;Integrated Security=True;Connection Timeout=60;
multipleactiveresultsets=true'" providerName="System.Data.EntityClient" />
和它给出了一个错误
[ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]
和
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
我的控制器看起来像这样
my controller looks like this
public ActionResult Index()
{
var post = cmsDB.Posts.ToList();
return View(post);
}
当我在我的本地机器上运行code一点问题都没有,但是当我进入
远程连接到SQL Server 2008中的问题出现了。
When I run the code on my local machine no problem at all but when I get into remotely connecting into SQL Server 2008 the problem arises.
非常感谢任何帮助。
推荐答案
您的连接字符串被配置为使用集成Windows身份验证(集成安全性= TRUE
)。对于这个工作,确保已在IIS中启用NTLM。此外,如果在SQL Server是在不同的物理机器上比Web服务器可能需要的配置委派。作为一种替代方法,你可以用一个固定的帐户使用SQL身份验证:
Your connection string is configured to use Integrated Windows Authentication (Integrated Security=True
). For this to work make sure you have enabled NTLM in IIS. Also if the SQL Server is on a different physical machine than the web server you might need to configure delegation. As an alternative you could use SQL authentication with a fixed account:
<add name="ApplicationServicesX"
connectionString="provider=System.Data.SqlClient;provider connection string='Data Source=asc-svr2; Initial Catalog=AdventureWorks;User Id=foo;Password=secret;Connection Timeout=60;multipleactiveresultsets=true'"
providerName="System.Data.EntityClient" />
这篇关于如何远程SQL Server 2008中使用MVC3 EF4连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!