简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM