无法打开数据库"ASPState";登录要求.登录失败.用户"sa"的登录失败. [英] Cannot open database "ASPState" requested by the login. The login failed. Login failed for user 'sa'.

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

问题描述

我到目前为止所做的事情,

步骤1:
在web.config中,

Things I did so far,

Step 1:
In web.config,

<system.web>
		<sessionState mode="SQLServer" sqlConnectionString="data source=KOTTA;uid=sa;pwd=asdf"></sessionState>
	</system.web>


步骤2:
在ms sql中,创建了一个名为"SessionMgmt"的数据库.

步骤3:
通过双击该位置运行"aspnet_regsql.exe",


Step2:
In ms sql, created a database named ''SessionMgmt''.

Step3:
Run ''aspnet_regsql.exe'' by double clicking it in the location,

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\
and in it, set server=KOTTA, Username=sa, Password=asdf and select Database as SessionMgmt


在运行项目时,出现错误,


On running the project, I get the error,

Cannot open database "ASPState" requested by the login. The login failed.
Login failed for user 'sa'. 




请帮助我.........




Please help me.........

推荐答案

步骤1:
在web.config中,
Step 1:
In web.config,
<system.web>
<sessionState mode="SQLServer" allowCustomSqlDatabase="true" sqlConnectionString="server=KOTTA;database=SessionMgmt;uid=sa;pwd=asdf"></sessionState>
	</system.web>



步骤2:
在ms sql中,创建了一个名为"SessionMgmt"的数据库.

步骤3:
使用带有以下命令行的命令提示符运行''aspnet_regsql.exe''

C:\ WINDOWS \ Microsoft.NET \ Framework \ v2.0.50727 \ aspnet_regsql -d SessionMgmt -S KOTTA -U sa -P asdf -ssadd -sstype c

-------------------------------------------------- -------------------------------------------------- -------------------
>
[ ^ ]此链接确实对我有帮助



Step2:
In ms sql, created a database named ''SessionMgmt''.

Step3:
Run ''aspnet_regsql.exe'' using command prompt with following command lines,

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql -d SessionMgmt -S KOTTA -U sa -P asdf -ssadd -sstype c

-----------------------------------------------------------------------------------------------------------------------

[^]This link really helped me


aspnet_regsql默认使用SQLExpress.首先检查一下.如果安装了SQL管理控制台,则验证数据库.

不过,最重要的是,您不应该将SA帐户用于任何用途.
aspnet_regsql defaults to using SQLExpress. Check that first. If you have SQL Management console installed then verify the databases.

Most importantly though, you should not be using the SA account for anything.


我完全同意不使用 sa 帐户的标记.但是,可能还有另一个原因导致此问题,这与SQL Server的身份验证模式有关.如果安装仅支持Windows身份验证,则上述连接字符串将不起作用.有关详细信息,请查看
http://msdn.microsoft.com/en-us/library/ms144284.aspx [ ^ ]和

http://msdn.microsoft.com/en-us/library/ms188670.aspx [ ^ ]
I completely agree with mark about not using sa account. however there can be one more reason for this problem and it''s related to authentication mode of SQL server. if the installation only support windows authentication then above connection string will not work. for details you can have a look at
http://msdn.microsoft.com/en-us/library/ms144284.aspx[^] and

http://msdn.microsoft.com/en-us/library/ms188670.aspx[^]


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

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