如何使用 MVC3 EF4 远程连接到 SQL Server 2008
我正在尝试远程连接,我首先使用 EF4 ctp5 代码在 MVC3 上有以下连接字符串
<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.
我的控制器看起来像这样
public ActionResult Index()
{
var post = cmsDB.Posts.ToList();
return View(post);
}
当我在本地计算机上运行代码时一点问题都没有,但是当我得到进入 远程连接到 SQL Server 2008 时出现问题。
非常感谢您的帮助。
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" />
and it gives an error
[ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]
and
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);
}
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.
Thanks a lot for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的连接字符串配置为使用集成 Windows 身份验证 (
Integrated Security=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: