嗨,我试图运行我的MVC 3应用程序,该应用程序运行SQLCE 4 Embedded和EF4.1
我已经使用了本教程中描述的数据访问方法
这在本地完美地工作(显然),但是在我的主机上运行它时,出现以下错误消息。这是一个共享的托管环境。
问题是开放的连接吗?它是否应该由工作单元类处理,该工作单元类按教程中所述在整个应用程序中以单例形式返回dbcontext?
关于这可能由什么引起的任何提示将不胜感激
内部错误:无法打开共享内存区域。
说明:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。
异常详细信息:System.Data.SqlServerCe.SqlCeException:内部错误:无法打开共享内存区域。
源错误:
当前Web请求的执行期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。
堆栈跟踪:
[SqlCeException (0x80004005): Internal error: Cannot open the shared memory region.] System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr) +40 System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent) +2542 System.Data.SqlServerCe.SqlCeConnection.Open() +113 System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +67 [EntityException: The underlying provider failed on Open.] System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +10975150 System.Data.EntityClient.EntityConnection.Open() +142 System.Data.Objects.ObjectContext.EnsureConnection() +97 System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +66 System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +47 System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +220 System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +383 System.Data.Entity.Internal.InternalContext.QueryForModelHash() +349 System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean throwIfNoMetadata) +109 System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +373 System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +64 [DataException: An exception occurred while initializing the database. See the InnerException for details.] System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +152 System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +199 System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +193 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +235 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +38 System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +89 System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21 System.Data.Entity.Internal.Linq.InternalSet`1.Find(Object[] keyValues) +37 Web.Infrastructure.DataAccess.Repository`1.GetByID(Object id) +131 Web.Controllers.PagesController.Home() +154 lambda_method(Closure , ControllerBase , Object[] ) +79 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39 System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +129 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +784922 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +784976 System.Web.Mvc.Controller.ExecuteCore() +159 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335 System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20 System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371
此错误表明SQL Server Compact数据库文件位于共享文件夹而不是本地驱动器上。那不管用。