C# 我无法在另一台电脑上运行我的应用程序

C# 我无法在另一台电脑上运行我的应用程序,c#,entity-framework,deployment,local-database,C#,Entity Framework,Deployment,Local Database,我用c编写了一个程序,我使用数据库作为本地数据库和entityframework。我完成了程序并创建了一个安装程序项目来部署它。我将database.sdf文件包含到安装程序项目的Model文件夹中,并将所有dll文件包含到C:\Program files\Microsoft SQL Server Compact Edition\v3.5中的应用程序文件夹中 我的连接字符串在App.Config文件中如下所示: <configuration> <connection

我用c编写了一个程序,我使用数据库作为本地数据库和entityframework。我完成了程序并创建了一个安装程序项目来部署它。我将database.sdf文件包含到安装程序项目的Model文件夹中,并将所有dll文件包含到C:\Program files\Microsoft SQL Server Compact Edition\v3.5中的应用程序文件夹中

我的连接字符串在App.Config文件中如下所示:

    <configuration>
  <connectionStrings>
    <add name="ApplicationEntities" connectionString="metadata=res://*/Model.Model1.csdl|res://*/Model.Model1.ssdl|res://*/Model.Model1.msl;provider=System.Data.SqlServerCe.3.5;provider connection string=&quot;Data Source=|DataDirectory|\Model\ApplicationDatabase.sdf&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>
当我在任何其他pc上安装程序并运行程序时,我会遇到如下异常:

    See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentException: 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)
   --- End of inner exception stack trace ---
   at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
   at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
   at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
   at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString)
   at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
   at Smart_Mail_Sender.Model.ApplicationEntities..ctor()
   at MailSender.Settings..ctor()
   at MailSender.FormMain.serverToolStripMenuItem_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.269 (RTMGDR.030319-2600)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Smart Mail Sender
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Default%20Company%20Name/Setup1/Smart%20Mail%20Sender.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.278 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.282 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.269 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Data.Entity
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Data.Entity/v4.0_4.0.0.0__b77a5c561934e089/System.Data.Entity.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.233 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.237 (RTMGDR.030319-2300)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.233 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Numerics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

我搜索了所有的互联网,找不到任何解决方法。您能帮助我吗?

您必须在计算机上安装SQL Server Compact 3.5运行时。您可以将compact edition的安装程序包含到自己的安装程序中

你可以在这里下载,如果你还没有的话

您必须在计算机上安装SQL Server Compact 3.5运行时。您可以将compact edition的安装程序包含到自己的安装程序中

你可以在这里下载,如果你还没有的话
电脑上未安装SQL CE 3.5的正确版本


还需要检查系统是32位还是64位操作系统,相应地安装安装程序。电脑上未安装SQL CE 3.5的正确版本


还需要检查系统是32位还是64位操作系统,相应地安装安装程序

验证目标计算机是否安装了SQL Server Compact 3.5,并且模型文件是否到位:model.Model1.csdl;Model.Model1.res;Model.Model1.ssdl;Model.Model1.msl.

验证目标计算机是否已安装SQL Server Compact 3.5,并且模型文件是否已就位:Model.Model1.csdl;Model.Model1.res;Model.Model1.ssdl;Model.Model1.msl.

已经运行。谢谢,但现在我需要将项目输出和SQL Server Compact 3.5安装程序链接在一起。你有这个问题的解决方案吗?我在安装项目中使用NSIS。如果您使用VS安装项目,这可能有助于它的工作。谢谢您,但现在我需要将项目输出和SQL Server Compact 3.5安装程序链接在一起。你有这个问题的解决方案吗?我在安装项目中使用NSIS。如果您使用VS安装项目,这可能会有所帮助