回答

收藏

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

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

嗨,我试图运行我的MVC 3应用程序,该应用程序运行SQLCE 4 Embedded和EF4.1
! C' w. s3 r8 Z4 p3 K' @我已经使用了本教程中描述的数据访问方法9 X0 M  o' ]. W. m9 [6 I& B  o' Y1 R
这在本地完美地工作(显然),但是在我的主机上运行它时,出现以下错误消息。这是一个共享的托管环境。0 K, _$ F0 r$ E3 P1 k- `$ A# {
问题是开放的连接吗?它是否应该由工作单元类处理,该工作单元类按教程中所述在整个应用程序中以单例形式返回dbcontext?6 s% K( s$ s) m9 Z" i
关于这可能由什么引起的任何提示将不胜感激. d% ^, R# k, `6 p: p. `
内部错误:无法打开共享内存区域。
/ L+ p7 o8 h4 E7 ~2 k6 k* F说明:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。! J- p, [5 z+ Y2 N/ s3 W# D" B

6 |$ n' r5 B( S- ~) j异常详细信息:System.Data.SqlServerCe.SqlCeException:内部错误:无法打开共享内存区域。# ]3 Y% J# L5 T9 f" b1 E+ s, o( _

) [5 e0 h+ u- f7 @. w源错误:' ^1 U; Q2 a3 e! S  x. Z; K2 A) N8 E! m
当前Web请求的执行期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。" F, J+ F- o) C
堆栈跟踪:
' h( g6 E" X- u, s( S  E# g; e   [SqlCeException (0x80004005): Internal error: Cannot open the shared memory region.]5 V3 n6 K7 V; {3 T7 L9 ]/ }+ n
   System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr) +40' v! w/ M# g5 r* Y0 Q/ y0 N/ {3 b
   System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent) +2542" q" t' A- c4 ~( `; ~
   System.Data.SqlServerCe.SqlCeConnection.Open() +113
; _: R4 N* t& p" d; ]( F   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +67
* O" d% n# H5 N0 K( \, q) x[EntityException: The underlying provider failed on Open.]
) L/ R; N2 C( ]& C0 b+ {! l+ h0 b   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +10975150- c5 W' f0 U5 l( O) P
   System.Data.EntityClient.EntityConnection.Open() +142
' J: F3 u: d3 G# L" @. c! P   System.Data.Objects.ObjectContext.EnsureConnection() +97
0 |4 e% [4 k) G6 B$ g. A   System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +66
5 K* C; r; m6 B  V2 M$ ~   System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() +471 ]0 [9 W% E8 w6 H' P- G  L8 K6 B7 V
   System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +220. i9 q( z# O* O& N& y
   System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +383
, }/ n, L8 W3 t+ U1 G   System.Data.Entity.Internal.InternalContext.QueryForModelHash() +3497 _& l6 J! Q0 t7 t5 }) q( |
   System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean throwIfNoMetadata) +109
0 Y2 x& o3 G& H# N4 U+ D   System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +373
: Z3 y8 y' ~: y   System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +64
7 t2 d& t& v; z0 r1 H1 v7 q5 L[DataException: An exception occurred while initializing the database. See the InnerException for details.]- k( D1 v. o9 W8 P% O
   System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +152
. S  x( [5 S- V. _1 W8 s   System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +199" g9 a$ D' ^) _# }1 }  r3 F9 H6 i7 Z
   System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +193
9 h* s7 M2 E8 F. j! A( m; R+ x   System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +2357 y3 \/ e$ j2 b% A" g3 f  |
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +38* s1 }( u/ W: j' f8 A$ u
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +890 R" ~$ J5 I4 M7 J. d8 i
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +211 Y$ Y% _* q& h4 @( H
   System.Data.Entity.Internal.Linq.InternalSet`1.Find(Object[] keyValues) +37
* O( Z* S. q& y* j2 ~" E   Web.Infrastructure.DataAccess.Repository`1.GetByID(Object id) +131
5 b7 Z0 L0 _' u3 |& C   Web.Controllers.PagesController.Home() +154
; G- ?0 ^: q- V. \0 M3 m/ B   lambda_method(Closure , ControllerBase , Object[] ) +79! q) B' s6 ]4 |3 W8 ~% D
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264: y: h+ I' T. ^' G2 t
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +394 S9 f; k6 }" w1 C( d6 Q4 I* u" g
   System.Web.Mvc.c__DisplayClass15.[I]b__12() +129) ^" z+ T: f0 q' ^
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +784922' I& X7 _1 D; f9 z, X+ K0 f
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +3144 s# q  I2 w( l% \
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +784976
6 L& j/ P% t8 T" M6 @   System.Web.Mvc.Controller.ExecuteCore() +159+ y% A, _0 K# g2 ?/ e
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
. X9 R# o9 f  P" M( E   System.Web.Mvc.c__DisplayClassb.[B]b__5() +62
9 g" t8 D1 K* C8 q9 r# X. {" u# F   System.Web.Mvc.Async.c__DisplayClass1.b__0() +20
7 T& ]3 u$ {! S2 v   System.Web.Mvc.c__DisplayClasse.b__d() +54
$ c8 n% g1 V' g6 c/ o+ N! f/ j   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +4536 d- [& p9 M3 G. T( W7 L/ s
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371+ G7 ]0 }; x( Z3 t  ?5 ]  q0 W
                ; {. {3 f6 z6 c+ K9 S
解决方案:
分享到:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则