Sneha Joshi
Sneha Joshi

Reputation: 81

how to deploy asp .net website alongwith database in IIS?

When I run website in browser, following server error occured -

Server Error in '/FinalHVA' Application.
--------------------------------------------------------------------------------

Cannot open database "HVAdb" requested by the login. The login failed.
Login failed for user 'COMP1\ASPNET'. 

Upvotes: 0

Views: 991

Answers (2)

Ta01
Ta01

Reputation: 31610

Can you post your web.config file , specifically the Database Connections, it looks like the login credentials being passed to the database is the Machine\ASPNET account

A Standard Connection String will look like this:

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

If you want to use the credentials of the user accessing the web application, you should use:

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI; 

Note - you should disable anonymous access on the virtual directory if you would like to use a trusted connection i.e. the second one.

Upvotes: 1

Oded
Oded

Reputation: 498904

Looks like the comp1\aspnet user doesn't have permissions to login to the HVAdb database.

Upvotes: 1

Related Questions