修复了无法打开登录请求的数据库.登录失败 [英] Fixed Cannot open database requested by the login. The login failed
问题描述
我尝试执行此Web应用程序,但是当我尝试在Web应用程序中注册用户帐户时,它给出了以下错误消息:
I try to execute this web application but it gave me this error messages when I try to register a user account in the web application:
发生System.Data.SqlClient.SqlException
HResult = 0x80131904
Message =无法打开登录请求的数据库"rentalsystem".登录失败.
用户'MicrosoftAccount \ corene100@outlook.com'登录失败.
Source = .Net SqlClient数据提供程序
System.Data.SqlClient.SqlException occurred
HResult=0x80131904
Message=Cannot open database "rentalsystem" requested by the login. The login failed.
Login failed for user 'MicrosoftAccount\corene100@outlook.com'.
Source=.Net SqlClient Data Provider
我在网上查找并尝试了所描述的任何解决方案,但每次尝试单击注册按钮时,都会弹出此错误.我已经在Microsoft SQL Server Management Studio中为MicrosoftAccount\corene100@outlook.com
创建了用户登录名(使用Windows身份验证),并确认它具有对数据库的db_owner
权限.
I look up online and try any of the solutions stated but still this error pops up every time I try to click the register button. I already created a user login for MicrosoftAccount\corene100@outlook.com
(using Windows authentication) in Microsoft SQL Server Management Studio and confirm that it has db_owner
permissions to the database.
但是,如果我尝试为SQL Server身份验证创建登录名,则由于存在特殊字符,因此登录名不可用.我之前已经连接了许多其他数据库,但从未弹出此错误.
However, if I try to create the login for SQL Server Authentication, the login name is not available because of the special character existed. I have connect a lot of other database before but none of this error pops up ever.
有什么方法可以让Visual Studio 2017使用我的原始用户登录凭据连接到数据库?这是DESKTOP-2UB7OKA\Corene
.我也尝试将连接字符串更改为此:
Is there any way to let the Visual Studio 2017 connect to database using my original user login credentials? Which is DESKTOP-2UB7OKA\Corene
. I have tried to change the connection string to this too:
Data Source=DESKTOP-2UB7OKA;Initial Catalog=rentalsystem;
Integrated Security=True;Pooling=False;User ID=MicrosoftAccount\corene100@outlook.com
或
Data Source=DESKTOP-2UB7OKA;Initial Catalog=rentalsystem;
Integrated Security=True;Pooling=False;User ID=DESKTOP-2UB7OKA\Corene
这些作品都没有.第二个仍然使它使用MicrosoftAccount\corene100@outlook.com
用户名登录数据库.
None of those works. And the second one still make it login to database using the MicrosoftAccount\corene100@outlook.com
username.
这是什么问题?我已经确认两个用户都具有数据库的db_owner权限,并且已经在Web应用程序属性上启用了Windows身份验证.我不知道下一步该怎么做.
What is the problem here? I have confirm both user have the db_owner permission to the database and I have enabled the Windows Authentication on the web application properties. I have no idea what's next I have to do.
请帮助,谢谢.
推荐答案
我遇到了这个问题,为我解决的问题是:
- 转到IIS中的应用程序池
- 右键单击我的项目应用程序池
- 在流程模型"部分中,打开身份"
- 选择自定义帐户选项
- 输入您的PC用户名和密码.
这篇关于修复了无法打开登录请求的数据库.登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!