2011-03-15 55 views
0

我試圖遠程連接,我已經使用EF4 CTP5代碼首先如何連接到使用MVC3 EF4

<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" /> 

我MVC3下面的連接字符串,它提供了一個錯誤遠程SQL Server 2008的

[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中的問題出現了。

非常感謝您的幫助。

+0

遠程SQL服務器是否允許來自其他服務器的連接?命名管道或通過TCP/IP? – 2012-07-31 04:58:17

回答

1

您的連接字符串被配置爲使用集成Windows身份驗證(Integrated Security=True)。爲此,請確保您在IIS中啓用了NTLM。另外,如果SQL Server與Web服務器位於不同的物理機器上,則可能需要configure delegation。作爲替代,您可以使用SQL身份驗證和固定帳戶:

<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" /> 
+0

謝謝@darin我看到問題的SSPI Windows身份驗證應該刪除連接字符串 – colorblack04 2011-03-15 09:14:02

+0

我試過這個解決方案,但我仍然得到相同的錯誤。我能做什麼錯了? – Sys 2011-05-30 18:07:40