Posts Tagged ‘database’
Microsoft.Practices.ServiceLocation.ActivationException–EnterpriseLibrary The type Database cannot be constructed
While moving code first time to live server, we started to get following error. I found that the issue in my case is, I do not put providerName="System.Data.SqlClient" in following connection string.
<add name="XYZ" connectionString="Data Source=localhost;Initial Catalog=LondonDreams;Persist Security Info=True;User ID=dream;Password=dream" providerName="System.Data.SqlClient"/>
Once I put that in above part, it worked fine for below error.
Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type Database, key "XYZ"
—> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of
—> the dependency failed, type =
"Microsoft.Practices.EnterpriseLibrary.Data.Database", name = "XYZ".
Exception occurred while: while resolving.
Exception is: InvalidOperationException – The type Database cannot be constructed. You must configure the container to supply this value.
At the time of the exception, the container was:
—> System.InvalidOperationException: The type Database cannot be constructed. You must configure the container to supply this value.