且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法打开数据库"ASPState";登录要求.登录失败.用户"sa"的登录失败.

更新时间:2022-06-08 09:11:30

步骤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[^]