can't initiate SQL Server compact server in Music Store Tutorial

Jan 16, 2012 at 7:05 PM

Hi I am new to Microsoft technology stack. Music store is an excellent tutorial to get me started. I have been following through the tutorial step by step with ease, until I got stuck at the database creation step.

I am using Visual Studio 2010 on Windows XP with SP3, and have SQL server compact server 4.0 installed.

When I tried to load the SampleData into the database, I got following exception:

 
Line 16:         public ActionResult Index()
Line 17:         {
Line 18:             var genres = storeDB.Genres.ToList();
Line 19:             return View(genres);
Line 20:         }

Source File: C:\Documents and Settings\kwang1\My Documents\Visual Studio 2010\Projects\MusicStore\MusicStore\Controllers\StoreController.cs    Line: 18

Stack Trace:

 
[PlatformNotSupportedException: Operation is not supported on this platform.]
   System.Data.SqlServerCe.SqlCeSHA256.Initialize() +151
   System.Data.SqlServerCe.SqlCeSHA256.InitFields(String provider, ProviderType providerType, AlgorithmId algorithm) +87
   System.Data.SqlServerCe.SqlCeSHA256..ctor() +167
   System.Data.SqlServerCe.HashProvider.CalculateHash(String filePath) +98
   System.Data.SqlServerCe.HashProvider.MatchHash(String filePath) +158
   System.Data.SqlServerCe.NativeMethods.IsValidBinary(String filename) +58
   System.Data.SqlServerCe.NativeMethods.ValidateNativeBinary(String modulePath) +69
   System.Data.SqlServerCe.NativeMethods.LoadValidLibrary(String modulePath) +265
   System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries() +247
   System.Data.SqlServerCe.SqlCeConnection..ctor() +70
   System.Data.SqlServerCe.SqlCeProviderFactory.CreateConnection() +43
   System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name) +640
   System.Data.Entity.Internal.LazyInternalConnection.Initialize() +85
   System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel() +31
   System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +249
   System.Data.Entity.Internal.InternalContext.Initialize() +30
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +34
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +148
   System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() +33
   System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator() +91
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +315
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
   MusicStore.Controllers.StoreController.Index() in C:\Documents and Settings\kwang1\My Documents\Visual Studio 2010\Projects\MusicStore\MusicStore\Controllers\StoreController.cs:18
   lambda_method(Closure , ControllerBase , Object[] ) +96
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
   System.Web.Mvc.Controller.ExecuteCore() +116
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8963149
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

Any ideas about how to work around this exception?

Thanks in advance for any suggestions.