简体   繁体   中英

Running an WPF/EF application with Sql Server CE on Windows XP

I have an application with EF 4.3.0 and Microsoft SQL Server CE 4.0.

Whenever I try to load the application, I get the following in error:

This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Data.SqlServerCe.UnmanagedLibraryHelper..ctor(String fileName)
at System.Data.SqlServerCe.NativeMethodsHelper..ctor(String modulePath)
at System.Data.SqlServerCe.NativeMethods.LoadValidLibrary(String modulePath)
at System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries()
at System.Data.SqlServerCe.SqlCeConnection..ctor()
at System.Data.SqlServerCe.SqlCeProviderFactory.CreateConnection()
at System.Data.Entity.Infrastructure.SqlCeConnectionFactory.CreateConnection(String nameOrConnectionString)
at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
at System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName()
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator()
at System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.IEnumerable.GetEnumerator()
at System.Data.Entity.DbExtensions.Load(IQueryable source)
at TestEfSqlCeOnXp.MainWindow.Window_Loaded(Object sender, RoutedEventArgs e)

I have tried the following approaches (with no luck) to solve the problem:

  1. Created a simple app with just EF and SQL CE
  2. Tried the solution in: How to deploy SQL Server Compact Edition 4.0?
  3. Private install: http://msdn.microsoft.com/en-us/library/aa983326%28VS.80%29.aspx
  4. Was getting "SideBySide" error in the Event Viewer, tried installing the "Microsoft Visual C++ 2008 Redistributable Package (x86)" in http://www.microsoft.com/en-ca/download/details.aspx?id=29 , didn't help either

Just more info on the WPF app, it works on Windows 7/8 but we're trying to retrofit it unto XP as this is a requirement for the project.

Thanks in advance StackOverflow community.

'Akapet

Problem solved:

ErickEJ made a good point of referencing 4.0.0.0 or 4.0.0.1 but I was already doing this. This made me to check the version of SQL Server CE I have installed on the XP machine, which was SQL CE 4.0.8876.1, and happened to be 4.0 SP1.

So the solution is uninstalling 4.0 SP1 and installing just 4.0 (no SP1) of SQL CE.

Now I don't get the error anymore, database gets created and no "SideBySide" error in the Event Viewer.

Thx all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM