当安装应用程序在另一台计算机上运行时,无法生成 SQL Server 错误的用户实例

发布于 2024-11-09 04:47:29 字数 965 浏览 0 评论 0原文

我无法在我自己的计算机以外的其他计算机上运行我的 C# 应用程序。我的项目中有一个附加的 mdf 数据库文件。我将“SQL SERVER 2008”作为安装项目的先决条件。该应用程序正在安装&在我的机器上运行良好,但是当我在另一台机器上安装并运行它时,它显示以下错误:

Description:
Stopped working

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01:   esbi.exe
Problem Signature 02:   1.0.0.0
Problem Signature 03:   4dd8feca
Problem Signature 04:   System.Data
Problem Signature 05:   2.0.0.0
Problem Signature 06:   4a274a01
Problem Signature 07:   2744
Problem Signature 08:   11
Problem Signature 09:   System.Data.SqlClient.Sql
OS Version: 6.1.7600.2.0.0.256.1
Locale ID:  1033

因此,我在第一次打开与数据库的连接时植入了一个 try-catch 块。发现以下错误:

System.Data.SqlClient.SqlException: 由于启动用户实例进程失败,无法生成 SQL Server 用户界面。连接将被关闭。

我用来连接数据库的连接字符串是

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\esbi.mdf;Integrated Security=True;User Instance=True

我做错了什么?与连接字符串有关吗? 有什么建议吗?

I am unable to run my c# application on a different computer other than my own computer. I have an attached mdf database file in my project. I have 'SQL SERVER 2008' as pre-requisite in the setup project. The application is installing & running fine on my machine, but when i install and run it on another machine, it shows the following error:

Description:
Stopped working

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01:   esbi.exe
Problem Signature 02:   1.0.0.0
Problem Signature 03:   4dd8feca
Problem Signature 04:   System.Data
Problem Signature 05:   2.0.0.0
Problem Signature 06:   4a274a01
Problem Signature 07:   2744
Problem Signature 08:   11
Problem Signature 09:   System.Data.SqlClient.Sql
OS Version: 6.1.7600.2.0.0.256.1
Locale ID:  1033

So, I planted a try-catch block on the first opening of connection to the database & caught the following error:

System.Data.SqlClient.SqlException: Failed to generate a user interface of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

The connection string i am using to connect to the database is

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\esbi.mdf;Integrated Security=True;User Instance=True

what am i doing wrong?? Is it something with the connection string??
any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

诗笺 2024-11-16 04:47:29

它可能是连接字符串中的“.\SQLEXPRESS”。当我部署到运行完整版 SQL 的服务器时,我必须将其更改为“(本地)”。

It could be the ".\SQLEXPRESS" in the connection string. When I deploy to my server that runs the full version of SQL I have to change that to "(local)".

誰ツ都不明白 2024-11-16 04:47:29

我有一个 wpf 应用程序在我的开发计算机上运行,​​但在部署到服务器时出现 System.Data.SqlClient.Sql 错误。在我的项目中,我将“应用程序”选项卡上的“目标配置文件:”从
“.NET Framework 4 Client_profile”到
“.NET Framework 4”,然后关闭、打开并重新链接它。
然后应用程序运行时没有出现错误,因为服务器有匹配的 .NET 框架

I had a wpf app that ran on my development machine but gave the System.Data.SqlClient.Sql error when deployed to a server. In my project I changed the "Target profile:" on the "Application" tab from
".NET Framework 4 Client_profile" to
".NET Framework 4" and then closed, opened and relinked it.
The app then ran without the error as the server had a matching .NET framework

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文