问题描述
几个小时以来,我一直在努力寻找这个问题的答案......
I'm been struggling to find an answer to this problem for hours now...
我过去在访问 ASPNETDB 数据库时不会收到此错误,但不幸的是我不知道我更改了什么.当我尝试访问名为 Admin 的文件夹中名为 Admin.aspx 的文件时出现错误.我使用网站管理工具对此文件夹设置了限制,但是当出现错误时,我将它们全部关闭以查看问题出在哪里,但我仍然收到错误?Admin.aspx 文件是唯一出现错误的文件..
I use to not get this error while accessing the ASPNETDB database, but unfortunately I don't know what I changed. The error comes up when I try to access a file called Admin.aspx I have in a folder called Admin. I had restrictions set on this folder using the Web Site Administration Tool, but when the error came up I took them all of them off to see what the problem was and I still get the error?? The Admin.aspx file is the only one that gets the error..
我在 web.config 中的连接字符串是:
My connection string in web.config is:
<add name="WIJLConnectionString1" connectionString="Data Source=localhost;Integrated Security=SSPI; Initial Catalog=ASPNETDB" providerName="System.Data.SqlClient" />
这里是错误:
异常详情:System.Data.SqlClient.SqlException:无法打开数据库ASPNETDB"由登录请求.登录失败的.用户登录失败'菲利普桌面\菲利普'.
[SqlException (0x80131904): 不能请求的打开数据库ASPNETDB"登录.登录失败.登录用户失败'菲利普桌面\菲利普'.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,布尔breakConnection)+5009598 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()+234 System.Data.SqlClient.TdsParser.Run(RunBehavior运行行为,SqlCommand cmdHandler,SqlDataReader 数据流,批量复制简单结果集批量复制处理程序,TdsParserStateObjectstateObj) +2275
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(BooleanenlistOK) +35
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo服务器信息,字符串新密码,布尔值 ignoreSniOpenTimeout,TimeoutTimer 超时,SqlConnection拥有对象)+183
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo服务器信息,字符串新密码,布尔重定向用户实例,SqlConnection 拥有对象,SqlConnectionString 连接选项,TimeoutTimer 超时)+239
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection拥有对象,TimeoutTimer 超时,SqlConnectionString 连接选项,字符串 newPassword,布尔值重定向用户实例)+195
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity身份,SqlConnectionString连接选项,对象providerInfo,字符串新密码,SqlConnection 拥有对象,布尔值重定向用户实例) +232
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions选项,对象池组提供者信息,DbConnectionPool 池,DbConnection拥有连接)+185
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection拥有连接,DbConnectionPool池,DbConnectionOptions 选项)+33System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection拥有对象)+524
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection拥有对象) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection拥有对象)+479
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection拥有连接)+108
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection外部连接,DbConnectionFactory连接工厂) +126
System.Data.SqlClient.SqlConnection.Open()+125 System.Data.Common.DbDataAdapter.FillInternal(DataSet数据集,DataTable[] 数据表,Int32startRecord, Int32 maxRecords, 字符串srcTable、IDbCommand 命令、命令行为行为)+123
System.Data.Common.DbDataAdapter.Fill(DataSet数据集,Int32 startRecord,Int32maxRecords,字符串 srcTable,IDbCommand 命令,CommandBehavior行为)+319
System.Data.Common.DbDataAdapter.Fill(DataSet数据集,字符串 srcTable) +92
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments参数)+1618
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments论据,DataSourceViewSelectCallback 回调)+21 System.Web.UI.WebControls.DataBoundControl.PerformSelect()+143 System.Web.UI.WebControls.BaseDataBoundControl.DataBind()+74 System.Web.UI.WebControls.GridView.DataBind()+4 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()+66 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()+75 System.Web.UI.Control.EnsureChildControls()+102 System.Web.UI.Control.PreRenderRecursiveInternal()+42 System.Web.UI.Control.PreRenderRecursiveInternal()+175 System.Web.UI.Control.PreRenderRecursiveInternal()+175 System.Web.UI.Page.ProcessRequestMain(BooleanincludeStagesBeforeAsyncPoint,布尔值includeStagesAfterAsyncPoint) +2496
[SqlException (0x80131904): Cannot open database "ASPNETDB" requested by the login. The login failed. Login failed for user 'Philip-Desktop\Philip'.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009598 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +183
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +239
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +195
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +232
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +33 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +524
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +479
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +108
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
System.Data.SqlClient.SqlConnection.Open() +125 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +123
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +319
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1618
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74 System.Web.UI.WebControls.GridView.DataBind() +4 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75 System.Web.UI.Control.EnsureChildControls() +102 System.Web.UI.Control.PreRenderRecursiveInternal() +42 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
有人请帮忙!!我现在很绝望
Someone please help!! I'm desperate at this point
推荐答案
错误信息尽可能清晰:
无法打开数据库ASPNETDB"由登录请求.登录失败的.用户登录失败'菲利普桌面\菲利普'
不允许该 Windows 用户连接到该数据库并使用它.
That Windows user isn't allowed to connect to that database and use it.
检查以确保:
您的连接字符串中有正确的服务器名称.真的是
localhost
吗?或者您是否安装了 SQL Server Express 并最终成为(local)\SQLExpress
?
that you have the proper server name in your connection string. Is it really
localhost
? Or did you perhaps install SQL Server Express and it ended up being(local)\SQLExpress
instead??
您要连接的服务器具有Philip-Desktop\Philip
的登录名(检查对象资源管理器->(您的服务器) -> 安全 -> 登录
)
that the server you're connecting to has a login for Philip-Desktop\Philip
(check in Object Explorer -> (your server) -> Security -> Logins
)
数据库 ASPNETDB 具有基于该登录名的用户,以便您可以使用该数据库(检查对象资源管理器 ->(您的服务器)-> 数据库->(您的数据库)-> 安全性 -> 用户
)
that the database ASPNETDB has a user based on that login so that you can use that database (check in Object Explorer -> (your server) -> Databases -> (your database) -> Security -> Users
)
您的 admin.aspx
页面确实引用了您提供的连接字符串 (WIJLConnectionString1
).您的 Admin
文件夹中是否有单独的 web.config
,例如具有不同的连接字符串,而 admin.aspx
页面改为引用该连接字符串??
that your admin.aspx
page is truly referencing that connection string you've given (WIJLConnectionString1
). Is there by any chance a separate web.config
in your Admin
folder that e.g. has a different connection string, and the admin.aspx
page references that connection string instead??
这篇关于无法打开数据库“ASPNETDB"由登录请求.登录失败.用户 &#39;Philip-Desktop\Philip' 登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!