无法连接到 SQL Server 2008 Express 实例
我有一个 SQL Server 2008 实例和一个 SQL Server 2008 Express 实例。
我主要使用带有以下连接字符串的 SQL Server 2008 实例...
<add name="Local-DB-connection" connectionString="Data Source=JONATHAN-PC; Database=dbname; User ID=uname; Password=pword;" providerName="System.Data.SqlClient" />
这工作正常。
现在在 Express 的实例上,我有一个具有相同名称和相同数据库的用户,但无论什么我总是收到此错误,
Cannot open database "dbName" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
现在我在 Express 连接字符串上添加了 - Trusted_Connection=True
,因此,NT AUTHORITY\NETWORK SERVICE
我找到了一个论坛帖子,我在修复实时服务器上的类似问题时使用过该帖子
它基本上讨论添加 NT AUTHORITY\NETWORK SERVICE' 用户,但该用户不在要添加的列表中。
我在这里疯了,我怀疑这与我的两个 SQL Server 实例冲突有关,
有人能解释一下吗?
谢谢特鲁吉利
i have an instance of SQL server 2008 and an instance of SQL server 2008 Express.
i have been mainly using the SQL server 2008 instance with the following connection string...
<add name="Local-DB-connection" connectionString="Data Source=JONATHAN-PC; Database=dbname; User ID=uname; Password=pword;" providerName="System.Data.SqlClient" />
this works fine.
now on the instance of express, i have a user with the same name and a identical database, but no matter what i always get this error
Cannot open database "dbName" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
now i have added - Trusted_Connection=True
on the express connection string, hence the NT AUTHORITY\NETWORK SERVICE
i have found a forum post which i have used when fixing a similar issues on my live server
it basically talks about adding the NT AUTHORITY\NETWORK SERVICE’ user, but this user is not in the list to add.
im going nuts here, and im suspecting its to do with my two SQL server instances conflicting
can anyone shed some light on this ??
thanks
truegilly
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是为了检查一下,您是否正在尝试使用正确的实例名称(即 JONATHAN-PC\SQLEXPRESS 或类似名称)访问 SQL Express 数据库?
网络服务应该在列表中。如果您转到
,那么它应该作为“网络服务”出现在列表中。如果您选择它,它将出现在 NT AUTHORITY 中。
将其添加到列表中后,您需要授予其访问数据库的权限。您的链接建议将其设置为 db_owner - 这对生产来说是危险的,您应该将其权限削减到更受限制的集合,但对于开发和证明它的工作可能没问题。
Just to check, you're trying to access the SQL Express database with the correct instance name, i.e. JONATHAN-PC\SQLEXPRESS or similar?
NETWORK SERVICE should be in the list. If you go to
then it should be in the list as NETWORK SERVICE. If you select that it'll then appear in NT AUTHORITY.
Once you've got it in your list you'll need to grant it access to your database. Your link suggests setting it as db_owner - that's dangerous for production, you should cut its permissions down to a more restricted set, but for development and proof-it's-working that's probably OK.