I have a windows service which is using SQL CE 4.0 compact edition database to stores some small information. I have tested the code in local and and the windows service is running successfully. But when I deployed the code in server , the windows service installed successfully but not started. It stopped and displayed the below error
The "MyService" service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.
So, when I looked in to the event viewer, I am seeing the following exception. What is the reason. How do I resolve this exception
Service cannot be started. System.TypeInitializationException: The type initializer for 'MyRepository' threw an exception. ---> Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type Database, key "LocalDbContext" ---> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Data.Database", name = "LocalDbContext".
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.