Shihan Khan
Shihan Khan

Reputation: 2188

Cannot open database error in Windows Server 2012

I'm trying to host my website in Windows Server 2012, I've configured everything and placed my site folder in wwwroot, when I launch from the IIS as a localhost I get this error at start,

Cannot open database "rental_db" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\mysitename.com'.

I've used Windows Authentication to login in sql server and I can access it properly. I'm not sure what is actually causing the problem. Here is the connection string code of web.config,

<add name="rental_dbEntities" connectionString="metadata=res://*/Models.rentalModel.csdl|res://*/Models.rentalModel.ssdl|res://*/Models.rentalModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=MYSERVER2012\SQLINSTANCENAME;initial catalog=rental_db;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

Note: I've shifted my published project folder from my desktop to server. Why is this happening?

Upvotes: 2

Views: 99

Answers (1)

rdn87
rdn87

Reputation: 724

You need create on your IIS App_Pool with the same name, and create in your SQL Server the user with all privileges.

Upvotes: 2

Related Questions