无法打开数据库“test"由登录请求.登录失败.用户“xyzASPNET"登录失败 [英] Cannot open database "test" requested by the login. The login failed. Login failed for user 'xyzASPNET'

查看:49
本文介绍了无法打开数据库“test"由登录请求.登录失败.用户“xyzASPNET"登录失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 Web 服务,它将一些数据保存到数据库中.但我收到此错误:

I have created a web service which is saving some data into to db. But I am getting this error:

无法打开登录请求的数据库test".登录失败.用户xyzASPNET"登录失败.

Cannot open database "test" requested by the login. The login failed. Login failed for user 'xyzASPNET'.

我的连接字符串是

Data Source=.SQLExpress;Initial Catalog=IFItest;Integrated Security=True

推荐答案

嗯,错误很明显,不是吗?您正在尝试使用用户xyz/ASPNET"连接到您的 SQL Server - 这是您运行 ASP.NET 应用程序的帐户.

Well, the error is pretty clear, no? You are trying to connect to your SQL Server with user "xyz/ASPNET" - that's the account your ASP.NET app is running under.

不允许此帐户连接到 SQL Server - 为该帐户在 SQL Server 上创建登录名,或然后在连接字符串中指定另一个有效的 SQL Server 帐户.

This account is not allowed to connect to SQL Server - either create a login on SQL Server for that account, or then specify another valid SQL Server account in your connection string.

您能否向我们展示您的连接字符串(通过更新您的原始问题)?

Can you show us your connection string (by updating your original question)?

更新:好的,您正在使用集成的 Windows 身份验证 --> 您需要在您的 SQL Server 上为xyzASPNET"创建一个 SQL Server 登录名 - 或者将您的连接字符串更改为:

UPDATE: Ok, you're using integrated Windows authentication --> you need to create a SQL Server login for "xyzASPNET" on your SQL Server - or change your connection string to something like:

connectionString="Server=.SQLExpress;Database=IFItest;User ID=xyz;pwd=top$secret"

如果您的数据库中有一个密码为top$secret"的用户xyz".

If you have a user "xyz" with a password of "top$secret" in your database.

这篇关于无法打开数据库“test"由登录请求.登录失败.用户“xyzASPNET"登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆