窗口应用程序崩溃

本文关键字:崩溃 应用程序 窗口 | 更新日期: 2023-09-27 18:11:43

使用一键发布(VS2010)我发布我的windows应用程序。这是一个非常简单的应用程序,只使用一个第三方库:EntityFramework。当它安装并运行时,它会在事件日志中生成以下错误:

Application: HNITPrinterMgtApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Data.EntityException
Stack:
   at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean,     System.Data.Common.DbConnection, System.Data.Common.DbConnection, System.String, System.String, Boolean ByRef)
   at System.Data.EntityClient.EntityConnection.Open()
   at System.Data.Objects.ObjectContext.EnsureConnection()
   at System.Data.Objects.ObjectQuery`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetResults(System.Nullable`1<System.Data.Objects.MergeOption>)
   at System.Data.Objects.ObjectQuery`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].System.Collections.Generic.IEnumerable<T>.GetEnumerator()
   at System.Data.Entity.Internal.Linq.InternalQuery`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetEnumerator()
   at System.Data.Entity.Internal.Linq.InternalSet`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetEnumerator()
   at System.Data.Entity.Infrastructure.DbQuery`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()
   at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]..ctor(System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Linq.Enumerable.ToList[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at HNITPrinterMgtApp.Classes.UiPresenter.GetCurrentListOfPrinters()
   at HNITPrinterMgtApp.HNITPrinter.SetFormForTypeOfUser()
   at HNITPrinterMgtApp.HNITPrinter.DetermineTypeOfUser()
   at HNITPrinterMgtApp.HNITPrinter..ctor()
   at HNITPrinterMgtApp.Program.Main()

所有的dll都在那里,需要…不太确定我错过了什么……或者我还需要做什么....

如果我使用EF与我的windows应用程序…我应该使用不同的分配方法吗?

窗口应用程序崩溃

有一件事要注意EF你需要有连接字符串在你的主app.config我知道从使用我自己的类库使用EF。也可能检查,以确保集成安全没有被使用或用户有权访问数据库。

原来是权限问题。一切都很好!