简体   繁体   English

使用安装程序安装程序安装时更改Windows服务的连接字符串

[英]Changing connection string of windows service while installing with setup installer

I have two projects in my solution. 我的解决方案中有两个项目。 One is an application. 一个是应用程序。 The other is a Windows service. 另一个是Windows服务。 I created a setup installer and added the primary output of these two projects to the installer. 我创建了安装程序安装程序,并将这两个项目的主要输出添加到安装程序中。 My setup installer asks for a data source while installing the application and the Windows service. 我的安装程序安装程序在安装应用程序和Windows服务时要求提供数据源。 After inputting the SQL server name the both application and the Windows service will be installed on the system. 输入SQL服务器名称后,将在系统上同时安装应用程序和Windows服务。 I am able to open and use the application with the changed connection string, but when I check the Windows service status it is not in a running state. 我可以使用更改后的连接字符串打开和使用该应用程序,但是当我检查Windows服务状态时,它不在运行状态。 When I try to start the Windows service manually I get 当我尝试手动启动Windows服务时,我得到

error 1053: the service did not respond to the start or control request into timely fashion". 错误1053:服务没有及时响应启动或控制请求”。

Any help is much appreciated. 任何帮助深表感谢。

您可能可以在事件查看器中找到一些线索。

您要更改正确的配置文件吗?对于Windows服务,配置文件必须位于.exe文件的同一文件夹中,并且必须具有相同的名称,例如MyService.exe和MyService.config

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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