|
嗨,我试图运行我的MVC 3应用程序,该应用程序运行SQLCE 4 Embedded和EF4.1# z" }- P3 O- H' T% d u6 M9 Y
我已经使用了本教程中描述的数据访问方法, K( y8 d) z9 c( x' }# k; d& m
这在本地完美地工作(显然),但是在我的主机上运行它时,出现以下错误消息。这是一个共享的托管环境。/ \* G/ z8 d* \* T6 o1 | h( W# p
问题是开放的连接吗?它是否应该由工作单元类处理,该工作单元类按教程中所述在整个应用程序中以单例形式返回dbcontext?
1 O q9 B# z J C; K关于这可能由什么引起的任何提示将不胜感激
' Z5 n7 g% |4 x c内部错误:无法打开共享内存区域。/ D Q* H/ e; k; X' |# G& ?
说明:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。
/ V1 R4 d) E7 T
- l( f5 m7 J2 `9 H6 ? j异常详细信息:System.Data.SqlServerCe.SqlCeException:内部错误:无法打开共享内存区域。" w& x; {) Z& g. ^' _
# o, i% ~2 F9 B% U- z6 u' J
源错误:
1 F8 H: R8 T' }: X, x当前Web请求的执行期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。
+ b( c9 v. o8 ~; Q; d' h8 B$ @: J堆栈跟踪:5 x$ [9 D: E) M
[SqlCeException (0x80004005): Internal error: Cannot open the shared memory region.]
* i* a0 p, C$ Q2 {) a4 _1 s# | System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr) +40
. ]; f% x+ ~3 o) d8 {5 A System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent) +25422 q% P% K2 x1 c+ d3 `6 H$ b* A) J
System.Data.SqlServerCe.SqlCeConnection.Open() +1137 p& j* U3 F/ Q$ x; Q ]
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +67
* Z5 ?- y! {( q0 x; Y, u( e[EntityException: The underlying provider failed on Open.]
3 i( n( V% z1 t- q9 y. c# }2 ] System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +10975150
0 H" O$ W: U" p i% i% } System.Data.EntityClient.EntityConnection.Open() +142
. A7 J% K+ s2 S System.Data.Objects.ObjectContext.EnsureConnection() +970 V' m/ a7 F; _; j# ?
System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +66
$ `8 [0 F% f. L# _ System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() +47
* \9 K* S. v% s2 ~6 y System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +220# I# P. ~4 j8 U, R2 }
System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +383
. ^9 n6 Q8 @0 j System.Data.Entity.Internal.InternalContext.QueryForModelHash() +349
& t- g. ^$ I! P5 p! k' o* G System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean throwIfNoMetadata) +109' K& p: P* Z' W4 {: |- a) T+ @! w8 R
System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +373
8 u; e+ w3 U. O* p7 d2 `# ~ System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +64& ?* w8 t) j: Q. A
[DataException: An exception occurred while initializing the database. See the InnerException for details.]
; z0 v5 B: F2 Y" e y/ C9 _4 ] System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +152
( s7 c% ] y b* F% s& P System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +199
( E L6 ]' {$ y# J$ p' M System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +193+ Q( T: O/ z. `" D' X0 S
System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +2352 U) W+ y5 }+ W0 L {% \ `
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +38
2 N: a9 r1 d2 F# n& l" X System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +89
9 a9 D' r' a! A$ U0 a( P System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21
* w0 E {: ~2 w System.Data.Entity.Internal.Linq.InternalSet`1.Find(Object[] keyValues) +374 s# c. f2 T8 _
Web.Infrastructure.DataAccess.Repository`1.GetByID(Object id) +131
2 A8 [9 v& K6 F3 G" K" \ Web.Controllers.PagesController.Home() +154. f* ]- g# k+ N4 v/ q8 | E
lambda_method(Closure , ControllerBase , Object[] ) +79
+ e! \. y+ B. w System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264
- D9 C' `, I/ R0 X+ w2 S" Y9 ^9 w* u System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +393 X% \5 ?1 y1 _2 j+ Y! ~: T
System.Web.Mvc.c__DisplayClass15.[I]b__12() +129
, Z( Q0 {3 n3 [" o4 ?7 Q System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +784922; J4 M. X4 ~4 Z0 O
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314
0 B+ m* y2 O' b. `' J! ` v System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +784976, R# D/ L1 ]7 m8 y3 \" H
System.Web.Mvc.Controller.ExecuteCore() +159
; P# |. l& K$ a5 R% { System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335" ? x6 w/ a2 Q p% A: m* \
System.Web.Mvc.c__DisplayClassb.[B]b__5() +62
& E" F4 }6 k5 ^6 s& c5 v3 c V* m System.Web.Mvc.Async.c__DisplayClass1.b__0() +20
1 ~9 U: {( L& @* ^ System.Web.Mvc.c__DisplayClasse.b__d() +54
0 w# R; ^7 o4 E" V9 [0 I6 A, B System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453
1 u9 c% ]% V& ~+ L4 L4 C System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371( x+ _: J2 `6 b2 P1 z6 P$ k
4 I7 v y2 S$ G) I! n+ {3 |解决方案: |
|