Mar 11, 2013 at 8:05 PM
Edited Mar 11, 2013 at 8:13 PM
I have a simple ASP.NET solution set up with three projects:
- A base library of a couple objects I set up.
- A Web API project
- An MVC 4 project
Projects 2 and 3 have a config file with the following code:
<add name="DefaultConnection" connectionString="Server=WORK-PC;Database=DevUT;Integrated Security=SSPI" />
I have tried setting Trusted_Connection to true as well.
The code in my Web API project is as follows:
Database db = DatabaseFactory.CreateDatabase("DefaultConnection"); //fails here even with CreateDatabase()
IDataReader dr = db.ExecuteReader(CommandType.Text, "SELECT * FROM Package");
I keep getting an error saying Activation error occured while trying to get instance of type Database, key "".
Additionally, I get prompted for the ServiceLocatorImplBase.cs file the first time I run the solution after opening Visual Studios.
My version of Unity is 2.1.505.2 and my version of Enterprise Library is 5.0.505.0.
Unity was preinstalled and Enterprise Library was installed with NuGet.
I have SQL Server 2012 (I don't think it's express) set up on the same machine that the project is running. I have a server (WORK-PC) running with a database (DevUT) underneath.
Any ideas? I can't seem to figure out how to connect to the database :/.