Reputation: 5393
Hi I just tryed to run my application fopr the first time on IIS. Everything worked find while developing on visual studio but when I added the app to IIS I got this error:
Cannot open user default database. Login failed.
Login failed for user 'IIS APPPOOL\forum'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Cannot open user default database.
What should I do the site works when I run it from visual studio?
EDIT
I did a litle more digging and I managed to find out that I needed to setmy application pool identity to NetworkService I did that but now I got another error :
Unable to open the physical file "D:\Projects IDE\Visual Studio\MyWork\Websites\Forum\App_Data\ASPNETDB.MDF". Operating system error 5: "5(Access is denied.)". An attempt to attach an auto-named database for file D:\Projects IDE\Visual Studio\MyWork\Websites\Forum\App_Data\ASPNETDB.MDF failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Upvotes: 3
Views: 911
Reputation: 21314
I received this non explicit error because I had the Application Pool set to .NET 2.0
as opposed to .NET 4.0
on a service that was responsible for authentication. Typically when the framework is incorrect a different type of error about a non-recognized framework .dll is displayed, but not in this case. If this happens, check the following:
IIS APPPOOL
is the name of the application pool this current process is run under. In your case there was an AppPool named forum
.Upvotes: 0
Reputation: 286
Please check two places 1 Access to folder for the NetworkService identity(default for IIS app pool) or for this one(IIS APPPOOL\forum) 2 Connection string credetial. And if there "Integrated security". Provide Specific user and passwrod there.
Upvotes: 1