2011-03-10 255 views
-1

好的,總的noob問題在這裏。我在玩Silverlight,需要連接到數據庫。當我在服務器資源管理器(VS 2010)中連接時,它工作正常,因爲它使用我的Windows帳戶進行身份驗證。但是,當我開始調試服務器端的東西時,它在SQL服務器上沒有任何權限的其他帳戶(NT-SERVICE或類似的東西)上運行。我已經試過嵌入我的用戶名/密碼是這樣的:SQL Server連接字符串

connectionString="Data Source=.;Initial Catalog={DATABASE};Integrated Security=True;User={DOMAIN}\{USERNAME};Password={redacted}"

,但似乎並不奏效。我不斷收到一個錯誤:

The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

感謝您的幫助,

埃裏克

+0

Data Source = myServerAddress; Initial Catalog = myDataBase; Integrated Security = SSPI; User ID = myDomain \ myUsername; Password = myPassword; – 2011-03-10 19:04:21

+0

沒有運氣。我用Integrated Security = False,True和SSPI試了一下,沒有運氣。我開始懷疑這是否與我的服務有關,而不是連接。 – 2011-03-10 19:46:32

+0

看起來它實際上是一個無關的問題。我想我現在需要更多地研究wcf。謝謝你的幫助。 – 2011-03-10 20:26:32

回答

0

原來我沒有將DataContracts添加到我的Linq-to-Sql類中。從linq-to-sql設計器中,將序列化設置爲單向。原來它與連接字符串完全無關。嘆息...

2

嘗試用戶ID =,不用戶=

connectionString="Data Source=.;Initial Catalog={DATABASE};Integrated Security=True;User Id={DOMAIN}\{USERNAME};Password={redacted}" 

http://www.connectionstrings.com/