我在客户端PC上部署了一个WPF应用程序,但每次尝试连接数据库时,应用程序都会崩溃(我使用SQLite并且无法使用其他任何东西),因为我无法调试它在客户端PC上,我无法100%确定问题所在。
我的要求是我无法安装任何第三方可执行文件,在这种情况下我无法安装(sqlite-netFx45-setup-x86-2012-1.0.90.0.exe),因为用户无法访问机器的GAC,但是当我在测试机上试用它时,它解决了我的问题。
到目前为止我做了什么:
add name="SQLite Data Provider" invariant="System.Data.SQLite" description="Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"
我已经找到了以下解决的问题,但它对我不起作用。
连接字符串是:metadata = res:// /Models.GreenPulseModel.csdl|res://< / em> /Models.GreenPulseModel.ssdl|res://*/Models.GreenPulseModel.msl ; provider = System.Data.SQLite; provider connection string =&#34; data source = D:PATH TO DATABASE \ DB \ GreenPulseDb.db; datetimekind = Utc; foreign keys = True; password = {PASSWORD}&#34; &#34;的providerName =&#34; System.Data.EntityClient
这是来自客户端PC的事件查看器的完整堆栈跟踪:
应用程序:GreenPulse.exe Framework版本:v4.0.30319描述:由于未处理的异常,进程已终止。异常信息:System.Configuration.ConfigurationErrorsException Stack:位于System.Data.EntityClient.EntityConnection的System.Data.Common.DbProviderFactories.GetFactory(System.String)的System.Data.Common.DbProviderFactories.GetFactory(System.Data.DataRow)处System.Data.Entity上的System.Data.EntityClient.EntityConnection.ChangeConnectionString(System.String)中的.GetFactory(System.String)System.Data.Entity.LazyInternalConnection.InitializeFromConnectionStringSetting中的System.SData.EntityClient.EntityConnection..ctor(System.String)系统的System.Data.Entity.Internal.LazyInternalConnection.Initialize()中的System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(System.String,System.Data.Entity.Internal.AppConfig)中的(System.Configuration.ConnectionStringSettings) System.Data.Entity.InternalContext.GetEntitySe的System.Data.Entity.Internal.LazyInternalContext.InitializeContext()处的.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel() System.Data.Entity.Internal.Linq.InternalSet1 [[System .__ Canon,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089]中的tAndBaseTypeForType(System.Type)。在System.Data处初始化()。 Entity.Internal.Linq.InternalSet1 [[System .__ Canon,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089]]。GetEnumerator()at System.Data.Entity.Infrastructure.DbQuery1 [[System .__ Canon, mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089]]。System.Collections.Generic.List1中的System.Collections.Generic.IEnumerable.GetEnumerator()[[System .__ Canon,mscorlib,Version = 4.0.0.0 System.Linq.Enumerable.ToList [System .__ Canon,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089,Culture = neutral,PublicKeyToken = b77a5c561934e089]] .. ctor(System.Collections.Generic.IEnumerable1) ]在MUC.Data.Infrastructure.Repository.GenericRepository2 [[System .__ Canon,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089] ,[System .__ Canon,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089]]。在MUC.Orion.WPFTemplate的MUC.Orion.WPFTemplate.DataServices.Repositories.InvoiceRepository.GetInvoiceHolders()中的GetAll()。位于MUC.Orion.WPFTemplate.Presentation.Musiness.M上的MUC.Orion.WPFTemplate.BusinessServices.BusinessManager.GetInvoiceHolders()中的DataServices.DataManager.GetInvoiceHolders()位于MUC.Orion.WPFTemplate.Presentation.ViewModels.Impl.InvoiceHolders.HolderSelectorViewModel.PopulateInvoiceHolders()。 MUC.Core.Reflection.Emitter.EmitterBase.Execute的MUC.Core.Reflection.Emitter.ConstructorInvoker.Invoke(System.Delegate)中的DynamicClass.ctor(System.Object)中的ViewModels.Impl.InvoiceHolders.HolderSelectorViewModel..ctor()系统中的MUC.Core.Reflection.Reflector.Construct(System.Type,System.Type [],System.Object [])的[System .__ Canon,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089] MUC.Core.Wpf.F中的.TypeExtensions.Construct(System.Type,System.Type [],System.Object []) MUC上的MUC.Core.Wpf.Services.Navigation.NavigationService.NavigateTo(System.String,Boolean,Boolean,System.Object [])中的actories.ViewFactory.CreateView(System.String,Boolean,System.Object [])。 MUC.Core上的MUC.Core.Wpf.Controls.Desktop.DesktopManager.ResolveContext(System.String)中的Core.Wpf.Services.Navigation.Navigator.NavigateTo(System.String,Boolean,Boolean,System.Object [])。位于MUC.Core.Wpf.Commands.ActionCommand1的MUC.Orion.WPFTemplate.ViewModels.ShellViewModel.OpenDesktop(System.Object)的Wpf.Controls.Desktop.DesktopManager.RegisterDesktop(MUC.Core.Wpf.Controls.Desktop.Desktop)[ [System .__ Canon,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089]。在MUC.Core.Wpf.Commands.CommandBase1上的OnExecute(System .__ Canon)[[System .__ Canon,mscorlib,Version = 4.0 .0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089]]。在MUC.Core.Wpf.Commands.CommandBase1执行(System .__ Canon)[[System .__ Canon,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e0在System.Windows.Controls.Primitives.ButtonBase的MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(System.Windows.Input.ICommandSource,Boolean)中的System.Windows.Input.ICommand.Execute(System.Object)。在System.Windows.Uindlement.OnMouseLeftButtonUpThunk(System.Object,System)上的System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs)中的System.Windows.Controls.Button.OnClick()上的OnClick()位于System.Windows.RoutedEventHandlerInfo的System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate,System.Object)的System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate,System.Object)中的.Windows.Input.MouseButtonEventArgs。 System.Windows.UIElement.ReRaiseEventAs上的System.Windows.EventRoute.InvokeHandlersImpl(System.Object,System.Windows.RoutedEventArgs,Boolean)中的InvokeHandler(System.Object,System.Windows.RoutedEventArgs)(System.Windows.DependencyObject,System。 Windows.RoutedEventArgs,System.Windo System.Windows.RoutedEventArgs上的System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate,System.Object)中的System.Windows.UIElement.OnMouseUpThunk(System.Object,System.Windows.Input.MouseButtonEventArgs)上的ws.RoutedEvent) System.Windows.EventRoute.InvokeHandlersImpl的System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object,System.Windows.RoutedEventArgs)中的.InvokeHandler(System.Delegate,System.Object)(System.Object,System.Windows.RoutedEventArgs,Boolean )System.Windows.Uindlement.RaiseEvent(System.Windows)上System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)的System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject,System.Windows.RoutedEventArgs)。 RoutedEventArgs,Boolean)位于System.Windows.Input上的System.Windows.InputManager.ProcessStagingArea()处于System.Windows.Input.Input.InputManager.InputManager.InputManager.InputManager.InputManager.InputManager。 Input.InputReport)at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr,MS)中的System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr,System.Windows.Input.InputMode,Int32,System.Windows.Input.RawMouseActions,Int32,Int32,Int32) .Internal.Interop.WindowMessage,IntPtr,IntPtr,Boolean ByRef)at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr,Int32,IntPtr,IntPtr,Boolean ByRef)at MS.Win32.HwndWrapper.WndProc(IntPtr,Int32,IntPtr) ,Int.Ptr,布尔ByRef)MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate,System.Object,Int32)at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority,System.TimeSpan,System.Delegate,System.Object,System.Object,System.Delegate,System.Object,Int32,System.Delegate), Int32)在MS.Win32.HwndSubclass.SubclassWndProc(IntPtr,Int32,IntPt) r,IntPtr)位于System.Windows.Threading.Dispatcher的System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)的MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)。 System.Windows.Application.RunInternal(System.Windows.Window)中System.Windows.Application.RunDispatcher(System.Object)上System.Windows.Threading.Dispatcher.Run()的PushFrame(System.Windows.Threading.DispatcherFrame) at System.Windows.Application.Run(System.Windows.Window)at System.Windows.Application.Run()at MUC.Orion.WPFTemplate.App.Main()
我不确定是否错过了什么。
任何帮助将不胜感激。 提前谢谢。