Winforms 基础提供程序在打开时失败。SQL Compact Edition 4和EntityFrameWork 6,Windows窗体应用程序部署
我希望我能很快从这里的专家那里得到答案 我的问题是: 基础提供程序在打开时失败 实体框架Winforms 基础提供程序在打开时失败。SQL Compact Edition 4和EntityFrameWork 6,Windows窗体应用程序部署,winforms,sql-server-ce-4,Winforms,Sql Server Ce 4,我希望我能很快从这里的专家那里得到答案 我的问题是: 基础提供程序在打开时失败 实体框架 位于System.Data.Entity.Core.EntityClient.EntityConnection.Open() 位于System.Data.Entity.Core.Objects.ObjectContext.EnsureReconnection(布尔值shouldMonitorTransactions) 在System.Data.Entity.Core.Objects.ObjectContex
位于System.Data.Entity.Core.EntityClient.EntityConnection.Open()
位于System.Data.Entity.Core.Objects.ObjectContext.EnsureReconnection(布尔值shouldMonitorTransactions)
在System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func
1 Func,IDbExecutionStrategy executionStrategy,Boolean startLocalTransaction,Boolean releaseConnectionOnSuccess)
在System.Data.Entity.Core.Objects.ObjectQuery中,在System.Data.Entity.Infrastructure.DefaultExecutionStrategy中,在System.Data.Entity.Core.Objects.ObjectQuery中,在System.Data.Entity.Core.Objects中执行[TResult](Func1操作)
1.GetResults(Nullable1 forMergeOption)位于System.Data.Entity.Core.Objects.ObjectQuery的System.Data.Entity.Internal.LazyEnumerator1.MoveNext()位于System.Collections.Generic.List的System.Linq.Enumerable.ToList的[TSource](IEnumerable
1 source)的System.Linq.Enumerable.ToList的
System.Data.SqlServerCe.SqlCeException(0x80004005):路径无效。检查数据库的目录。[Path=D:\SDB001.sdf]在System.Data.SqlServerCe.SqlCeConnection.Open(布尔静默)在System.Data.SqlServerCe.SqlCeConnection.Open()在System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.b_u36(DbConnection t,DbConnectionInterceptionContext c)在System.Data.Entity.Infrastructure.InternalDispatcher.InternalDispatcher1.在System.Data.Entity.Infrastructure.Interpatcher.DbConnectionDispatcher.Open上调度[TTarget,Action
2 operation,tPerceptionContext,Action3 executing,Action
3 executedSystem.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute(操作操作)在System.Data.Entity.Core.EntityClient.EntityConnection.b_uu2()处的System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute(操作)在System.Data.Entity.Core.EntityClient.EntityConnection.Open()处
System.Collections.ListDictionaryInternal
我用于从数据库获取数据的方法:
public static List<ActivityLog> GetAllActivity()
{
try
{
SEDMEntities context = new SEDMEntities();
List<ActivityLog> ag = (from m in context.ActivityLogs
select m).ToList();
return ag;
}
catch (Exception ex)
{
MainForm.LogExceptionToFile(ex, "Exception While Getting the list of activities");
throw;
}
}
我从下面的链接中遵循了步骤1到步骤7的所有步骤:
以下是有关我的环境和操作系统的更多详细信息
- Windows 8.1 x64
- Visual Studio 2013终极版
- ASP.NET 4 Windows窗体应用程序
- SQL Server CE 4
- 实体框架6
请让我知道,如果你需要任何进一步的细节从我
当我使用VS2013调试器运行代码时,我的机器上的一切都正常工作
但是当我进行设置时,上面的错误就来了。说路径无效。您是否使用文件资源管理器查看路径是否正确,以及SQL CE mdf文件是否实际位于该路径中?
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="StrantinEDMEntities" connectionString="metadata=res://*/SEDM.csdl|res://*/SEDM.ssdl|res://*/SEDM.msl;provider=System.Data.SqlServerCe.4.0;provider connection string="Data Source=D:\SDB001.sdf""
providerName="System.Data.EntityClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<runtime>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.22.0" newVersion="2.2.22.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.22.0" newVersion="2.2.22.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.13.0" newVersion="1.2.13.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Threading.Tasks.Extensions.Desktop" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.168.0" newVersion="1.0.168.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
<loadFromRemoteSources enabled="true" />
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
</configuration>