小编Geo*_*rge的帖子

如果从pendrive或服务器执行,实体框架将失败

我的应用程序是使用.Net 4.0 Client Profile,WPF,EF 6.0,Code-First,2 dataproviders(SQL Server CE和MySQL)创建的.

如果我将调试/发布文件夹复制到本地文件路径,它可以正常工作.

但如果将此文件夹复制到pendrive或放入服务器文件夹中.我第一次需要创建DbContext或调用数据库初始化程序时,它失败并出现以下错误(J:是我的pendrive):

'System.Data.Entity.Internal.AppConfig'的类型初始值设定项引发异常创建实体框架的配置节处理程序时发生错误:请求失败.(J:\USERS\George\Release\app.Config第6行)

System.TypeInitializationException: System.Void DG.Apps.JLM.Questoes.Presentation中'System.Data.Entity.CreateDatabaseIfNotExists 1 [DG.Apps.JLM.Questoes.Domain.Contexts.QuestoesContext] .. ctor()的类型初始值设定项.App.OnStartup(System.Windows.StartupEventArgs e)位于j:\ USERS\George\Release\Common\Common\Apps\JLM\DG.Apps.JLM.Questoes\DG.Apps.JLM.Questoes.Presentation\App. xaml.cs: Object System.Windows.Application的第30行.<.ctor> b__1(System.Object unused) 在Object System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback,System.Object args,System.Int32) numArgs) at System MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object source,System.Delegate方法,System.Object args,System.Int32 numArgs,System.Delegate catchHandler) System.Void System.Windows.Threading.DispatcherOperation 静态System.Void系统 上的静态System.Void System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object状态)中的.InvokeImpl().Threading.ExecutionContext.runTryCode(System.Object userData) 静态System.Void System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext,System.Threading.ContextCallback回调,System.Object状态) 静态System.Void系统.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext,System.Threading.ContextCallback回调,System.Object状态,System.Boolean ignoreSyncCtx) 静态System.Void System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext) ,System.Threading.ContextCallback回调,System.Object状态) , 位于System.Void的System System.Windows.Threading.DispatcherOperation.Invoke()System.Windows.Threading.Dispatcher.ProcessQueue(), 位于IntPtr System.Windows.Threading.Dispatcher .WndProcHook(System.IntPtr hwnd,System.Int32 msg,System.IntPtr wParam,System.IntPtr lParam,System.Boolean处理) 在IntPtr MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd,System.Int32 msg,System.IntPtr wParam,System.IntPtr …

c# wpf entity-framework app-config ef-code-first

3
推荐指数
1
解决办法
1474
查看次数

标签 统计

app-config ×1

c# ×1

ef-code-first ×1

entity-framework ×1

wpf ×1