回答

收藏

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

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

嗨,我试图运行我的MVC 3应用程序,该应用程序运行SQLCE 4 Embedded和EF4.1) Y9 H( N8 R3 J, p) |* ^& t
我已经使用了本教程中描述的数据访问方法
; P6 o6 c% I$ p2 s- y  @& H0 D- Q这在本地完美地工作(显然),但是在我的主机上运行它时,出现以下错误消息。这是一个共享的托管环境。
$ M5 D3 M* {' D9 u6 O# f7 }; n问题是开放的连接吗?它是否应该由工作单元类处理,该工作单元类按教程中所述在整个应用程序中以单例形式返回dbcontext?! ]! V  r* X, ]2 \, @
关于这可能由什么引起的任何提示将不胜感激
" g1 s2 p, f( b! K+ U8 S5 r内部错误:无法打开共享内存区域。  y6 h/ L! s4 I" K6 H! I4 f
说明:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。
! l1 I+ \. B4 }. V9 W/ Q3 I( l/ o. |  y& j" s, m8 }( _' v
异常详细信息:System.Data.SqlServerCe.SqlCeException:内部错误:无法打开共享内存区域。
" k+ D& }& z" e

- n8 }. S' n9 p* ^: {* y源错误:
$ a/ f8 }& N! _( ^$ f9 H7 M$ {当前Web请求的执行期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。0 _8 u4 N7 P( o: g! [% T/ t
堆栈跟踪:
( l- v; e  [9 a/ H   [SqlCeException (0x80004005): Internal error: Cannot open the shared memory region.]
0 f0 `# n4 x% F8 R5 K& a- v   System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr) +40  e) K4 t' {" A/ ~  V; X
   System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent) +2542
, [3 G/ X3 ^5 `, h3 M. ?   System.Data.SqlServerCe.SqlCeConnection.Open() +113
" @6 K- c% `# Y) T$ x; x/ W1 i   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +67
/ P. ]6 m1 j) G, B4 i[EntityException: The underlying provider failed on Open.]0 \) X: S8 s  s" c& T# ?! r$ j7 F. }
   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +10975150
! c2 e4 S3 X; }7 |" A4 d7 A& S& p   System.Data.EntityClient.EntityConnection.Open() +142) }' E: i1 X; r, g9 _2 ~
   System.Data.Objects.ObjectContext.EnsureConnection() +973 H8 m' ]3 Z# m- S, h/ j
   System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +664 T5 D) r% s+ |) C
   System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() +47) W/ A- e: b, i
   System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +2201 c* d1 P3 @" l: A; w
   System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +383" o" O7 \% X! p2 J
   System.Data.Entity.Internal.InternalContext.QueryForModelHash() +349
. \, v( L. ^5 i5 T9 ^/ ^) i   System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean throwIfNoMetadata) +109( P" Q+ Y: O5 {/ L+ s
   System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +373
1 R6 a# h8 `5 I. e   System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +64- @1 N1 r, X+ W* J
[DataException: An exception occurred while initializing the database. See the InnerException for details.]8 |2 N6 N; ]- u. Q. a  @7 e  u* y2 G
   System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +152
5 H3 L1 f% b7 G  Q7 ^0 g   System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +199
! R* |) T0 x2 R" d   System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +193
' X- D, v1 F( P: }! x. e   System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +235
& A: y% z5 M7 Y) M8 B8 T: X   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +38
5 [6 Z/ r* }5 \1 P   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +896 d) W& i; ?2 e1 ]" V$ P6 j+ W5 Q
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21
; o# R6 _; |6 c& v6 `   System.Data.Entity.Internal.Linq.InternalSet`1.Find(Object[] keyValues) +37
; e* @2 h' u  M% w   Web.Infrastructure.DataAccess.Repository`1.GetByID(Object id) +131; E. ?% B) x" a. h& U
   Web.Controllers.PagesController.Home() +154
6 q! k3 V4 Q! o   lambda_method(Closure , ControllerBase , Object[] ) +79
9 p5 G9 O+ y1 L0 s   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264
& z1 l& q1 _3 h: H7 X   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39! [/ W+ [% K2 p/ S5 }/ V
   System.Web.Mvc.c__DisplayClass15.[I]b__12() +129* b2 A6 d% E4 Q8 I9 K
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +784922
) W) o/ }% b% ^   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314
' r) @+ q2 F8 x* O( u3 E' B7 ^   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +784976
4 ]7 a4 |7 }/ I/ {* U" A% I& v  ?   System.Web.Mvc.Controller.ExecuteCore() +159
' t* w* j3 `. \! S* P; [   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
/ L+ o. C# I5 J. M; a/ i   System.Web.Mvc.c__DisplayClassb.[B]b__5() +62' w. ?) U3 _5 o; m' o8 S) `
   System.Web.Mvc.Async.c__DisplayClass1.b__0() +20
* u+ h& x( Z: u  O( l   System.Web.Mvc.c__DisplayClasse.b__d() +54, ^3 a, o: h. H" b' X
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453
$ p, H. s3 [, y- A& E6 ?. M7 |$ D   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371
( w: p2 O) z0 `               
( h$ s$ _7 \) K' S$ I8 Q解决方案:
分享到:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则