简体   繁体   English

无法连接到SQL Server 2008 Express实例

[英]Cannot connect to SQL server 2008 Express instance

i have an instance of SQL server 2008 and an instance of SQL server 2008 Express. 我有一个SQL Server 2008实例和一个SQL Server 2008 Express实例。

i have been mainly using the SQL server 2008 instance with the following connection string... 我主要使用带有以下连接字符串的SQL Server 2008实例...

<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 现在在express实例上,我有一个具有相同名称和相同数据库的用户,但是无论我总是得到什么错误

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 现在,我在快速连接字符串上添加了Trusted_Connection=True ,因此,NT AUTHORITY \\ NETWORK SERVICE

i have found a forum post which i have used when fixing a similar issues on my live server 我发现了一个论坛帖子,该帖子在修复实时服务器上的类似问题时使用

http://blog.sqlauthority.com/2009/08/20/sql-server-fix-error-cannot-open-database-requested-by-the-login-the-login-failed-login-failed-for-user-nt-authoritynetwork-service/ http://blog.sqlauthority.com/2009/08/20/sql-server-fix-error-cannot-open-database-requested-by-the-login-the-login-failed-login-failed-for-用户NT授权网络服务/

it basically talks about adding the NT AUTHORITY\\NETWORK SERVICE' user, but this user is not in the list to add. 它基本上讨论的是添加NT AUTHORITY \\ NETWORK SERVICE的用户,但是该用户不在要添加的列表中。

im going nuts here, and im suspecting its to do with my two SQL server instances conflicting 我在这里疯了,我怀疑它与我的两个SQL Server实例冲突有关

can anyone shed some light on this ?? 谁能对此有所启发?

thanks 谢谢

truegilly 真诚地

Just to check, you're trying to access the SQL Express database with the correct instance name, ie JONATHAN-PC\\SQLEXPRESS or similar? 只是为了检查,您尝试使用正确的实例名称(即JONATHAN-PC \\ SQLEXPRESS或类似名称)访问SQL Express数据库?

NETWORK SERVICE should be in the list. 网络服务应在列表中。 If you go to 如果你去

  • Security, Logins, New Login, Search, Advanced 安全性,登录名,新登录名,搜索,高级
  • Select your PC in the Locations box (should be default unless you're on a domain) 在“位置”框中选择您的PC(除非是域,否则应为默认设置)
  • Find now 现在找

then it should be in the list as NETWORK SERVICE. 那么它应该在列表中作为“网络服务”。 If you select that it'll then appear in NT AUTHORITY. 如果选择该选项,它将显示在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. 您的链接建议将其设置为db_owner,这对生产很危险,您应该将其权限缩减为更严格的设置,但是对于开发和证明工作而言可能还可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM