简体   繁体   中英

Deploying a project with a SQL Server CE database

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:

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" />

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

  • Under your project properties, on the Publish tab, click Application Files .
  • Look for System.Data.SqlServerCe.dll (possibly by checking the Show All Files box).
  • Make sure that its Publish Status is Include .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM