回答

收藏

SQLCE 4-EF4.1内部错误:无法打开共享内存区域

技术问答 技术问答 352 人阅读 | 0 人回复 | 2023-09-11

嗨,我试图运行我的MVC 3应用程序,该应用程序运行SQLCE 4 Embedded和EF4.1
: g, Z" S' G. H8 L) C* X我已经使用了本教程中描述的数据访问方法# e% h4 f( m( v7 u
这在本地完美地工作(显然),但是在我的主机上运行它时,出现以下错误消息。这是一个共享的托管环境。# O  x5 E! y8 b, ]) G! Y2 v* W$ ^  D0 c
问题是开放的连接吗?它是否应该由工作单元类处理,该工作单元类按教程中所述在整个应用程序中以单例形式返回dbcontext?8 L" I* l" P: s8 M+ ^3 D
关于这可能由什么引起的任何提示将不胜感激
+ m4 R  x, u/ v内部错误:无法打开共享内存区域。
/ T' N4 _" @/ L  ~8 v  o说明:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。7 n9 X, T  x2 r' \

' D0 {# p/ a/ s异常详细信息:System.Data.SqlServerCe.SqlCeException:内部错误:无法打开共享内存区域。$ }2 N- h, c, Z1 Y' a! {8 n
) V* k. \* n/ w  G: r
源错误:' ]1 F& `; g8 \, Q; W# w
当前Web请求的执行期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。
* L. `" V2 k! M7 ^堆栈跟踪:
) _( s0 z/ y+ e0 {1 w   [SqlCeException (0x80004005): Internal error: Cannot open the shared memory region.]
/ S' H/ f  T' e   System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr) +40& e! f+ m: ]3 F
   System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent) +2542
( w  S' u( u% T0 d' ]1 ^, K   System.Data.SqlServerCe.SqlCeConnection.Open() +113
7 }7 A3 h) ^( r6 _3 f& ~$ ?2 s5 E   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +67; I. q: y0 U4 X, F! t
[EntityException: The underlying provider failed on Open.]
* {  A( I4 x+ D7 [; W0 E   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +10975150  X6 y# }: R3 J' P
   System.Data.EntityClient.EntityConnection.Open() +142# a5 T6 m$ C7 }
   System.Data.Objects.ObjectContext.EnsureConnection() +97
& ?& s, `% v) b   System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +66% ?. h$ P) o4 _1 ~
   System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() +47: x; w8 t4 q5 P0 \  a
   System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +220
. f& s3 c/ m* [  ]   System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +383
4 `7 _' H  _2 @( k: t   System.Data.Entity.Internal.InternalContext.QueryForModelHash() +3496 @  z$ N8 H1 G1 D4 l/ v
   System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean throwIfNoMetadata) +109
. e2 C; ?0 L$ D" h, [& S   System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +373
1 D( ^- U/ d6 E0 W, \$ n   System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +64( V( U: T+ Z# X1 @0 ~# T' I
[DataException: An exception occurred while initializing the database. See the InnerException for details.]
. y6 g4 o4 n4 ]; `' C& M9 C( b   System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +152
4 |5 @5 `( j  d4 k% Z- w1 F, X1 {! T   System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +199
7 ~, i0 M/ P+ S   System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +193+ L  [7 g5 K5 P! J
   System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +235
8 B8 r7 ^; N5 H, i* a   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +38
! {- W/ o$ q6 _1 P$ S% [   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +892 w6 P5 e9 ?" v
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21
& v/ E  |& `. A* [   System.Data.Entity.Internal.Linq.InternalSet`1.Find(Object[] keyValues) +37
' C( G* e% }; Y, b1 p# n# S+ v2 s   Web.Infrastructure.DataAccess.Repository`1.GetByID(Object id) +1315 B7 a) ~. a$ \, f' I+ Y
   Web.Controllers.PagesController.Home() +154
6 o9 x, ~6 A: j) P! x   lambda_method(Closure , ControllerBase , Object[] ) +792 ]& {' Q5 G5 j& Y" B6 t
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264
' N" d1 w2 ~% v* G& C   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
) [3 e" G% M: C& a- ~   System.Web.Mvc.c__DisplayClass15.[I]b__12() +129  R" F2 E0 W" W- u5 J; a
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +784922' E; Q7 [8 n9 I
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314# Z. {4 f! F" X. p+ @' }( f
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +784976$ k& l- t- _) b9 m0 d3 ]& {
   System.Web.Mvc.Controller.ExecuteCore() +159
/ @: C/ `( @! E, H0 f3 x   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
3 j6 d5 p1 }; S2 t   System.Web.Mvc.c__DisplayClassb.[B]b__5() +62
+ @, l' |' _9 R" m   System.Web.Mvc.Async.c__DisplayClass1.b__0() +20
+ |) d" V6 m) e& @   System.Web.Mvc.c__DisplayClasse.b__d() +54
7 \/ M4 ~, o% H+ ?& j   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453
& S" b6 \: v$ Z* m3 ?  v% K   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +3711 b# v# u! d% t9 h0 Y8 P! s
                " Y5 q/ X* I( v4 x2 R
解决方案:
分享到:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则