部署项目与SQL Server CE数据库数据库、项目、Server、SQL

2023-09-06 17:38:36 作者:생활 사ƹ

我想部署一个使用 .SDF 文件和实体框架的应用程序。每当部署的应用程序试图使用实体(连接到数据库),我得到的错误:

I am trying to deploy an application that uses a .SDF file and the Entity Framework. Whenever the deployed application tries to use the entity (connect to the DB) I get the error:

指定的存储提供不能在配置中找到,或者是无效的。照片   System.ArgumentException:无法找到所需的.NET Framework数据提供。它可能没有安装。   在System.Data.Common.DbProviderFactories.GetFactory(字符串providerInvariantName)   在System.Data.EntityClient.EntityConnection.GetFactory(字符串providerString)

The specified store provider cannot be found in the configuration, or is not valid. System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed. at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)

我的连接字符串是这样的:

My connection string looks like this:

<add name="DBEntities" 
    connectionString="metadata=res://*/DB_Model.csdl|res://*/DB_Model.ssdl|res://*/DB_Model.msl;
    provider=System.Data.SqlServerCe.3.5;
    provider connection string=&quot;Data Source=|DataDirectory|\Database\DB.sdf&quot;" 
    providerName="System.Data.EntityClient" />

我读的地方,我可能需要有一个引用的DLL System.Data.SqlServerCe.3.5 ,但我不确定。任何帮助将是非常美联社preciated!

I have read somewhere that I may need to have a reference to the dll for System.Data.SqlServerCe.3.5 but I am unsure. Any help would be much appreciated!

推荐答案

您需要可以在目标系统上安装3.5 SP2运行时,或者使用专用部署如下所述:的 http://erikej.blogspot.com/2012/05/private-deployment-of-sql-server。 HTML

You need to either install the 3.5 SP2 runtime on the target system, or use Private Deployment as described here: http://erikej.blogspot.com/2012/05/private-deployment-of-sql-server.html