2011-03-10 381 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/