Regnillobian
asked on
Connecting to SQL Server from ASP.NET web page
I have a SQL database that I access through ASP.NET to return XML. This is working fine on another server. I backed up that database on the other server and restored it to my local server, which should have identical setup. But when I run the ASP.NET page to retrieve data, I get the error message below. The login itself is not failing, which is Windows Authentication, because I can connect to the database using SQL Server Management Studio and run a query. IIS has impersonate set to true. Here is the error I receive from the ASP.NET web page.
Cannot open database "AAA" requested by the login. The login failed. Login failed for user 'BBB\cccc'. CommandText: CEConfig.Facility_List CommandType: 4 Parameter: @FacilityID Value: Parameter: @Name Value: Stack: at System.Data.SqlClient.SqlI nternalCon nection.On Error(SqlE xception exception, Boolean breakConnection) at System.Data.SqlClient.TdsP arser.Thro wException AndWarning () at System.Data.SqlClient.TdsP arser.Run( RunBehavio r runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlI nternalCon nectionTds .CompleteL ogin(Boole an enlistOK) at System.Data.SqlClient.SqlI nternalCon nectionTds .LoginNoFa ilover(Ser verInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) at System.Data.SqlClient.SqlI nternalCon nectionTds .OpenLogin Enlist(Sql Connection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlI nternalCon nectionTds ..ctor(DbC onnectionP oolIdentit y identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlC onnectionF actory.Cre ateConnect ion(DbConn ectionOpti ons options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.D bConnectio nFactory.C reatePoole dConnectio n(DbConnec tion owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.D bConnectio nPool.Crea teObject(D bConnectio n owningObject) at System.Data.ProviderBase.D bConnectio nPool.User CreateRequ est(DbConn ection owningObject) at System.Data.ProviderBase.D bConnectio nPool.GetC onnection( DbConnecti on owningObject) at System.Data.ProviderBase.D bConnectio nFactory.G etConnecti on(DbConne ction owningConnection) at System.Data.ProviderBase.D bConnectio nClosed.Op enConnecti on(DbConne ction outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlC onnection. Open() at SQLDatabaseConnector.Datab aseConnect ions.Execu teReader(S qlCommand oCmd) Event Log Error: Cannot open log for source 'SQLDatabaseConnector'. You may not have write access.
Cannot open database "AAA" requested by the login. The login failed. Login failed for user 'BBB\cccc'. CommandText: CEConfig.Facility_List CommandType: 4 Parameter: @FacilityID Value: Parameter: @Name Value: Stack: at System.Data.SqlClient.SqlI
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
lol, that can do it :P
ASKER
It was also helpful to check the SQL error log. That got us on the right track.
ASKER
It was also helpful to check the SQL error log. That got us on the right track.
ASKER