简体   繁体   English

安装服务应用程序不会安装它

[英]installing a service app does not install it

I have read the other similar posts on this forum, I promise! 我保证,我已经阅读了该论坛上的其他类似帖子! However they haven't helped me 但是他们没有帮助我

I want to create an installer (msi) for my service app such that it will automatically get installed without the customer having to use the commandline. 我想为我的服务应用程序创建一个安装程序(msi),这样它将自动安装,而客户不必使用命令行。 I know this can be done. 我知道这可以做到。

I am using Visual Studio 2008 Team System, on Windows 7. My Windows account has admin privileges. 我在Windows 7上使用Visual Studio 2008 Team System。我的Windows帐户具有管理员权限。 I get the same experience trying to install the service in a Windows XP machine. 我在尝试在Windows XP计算机中安装服务时获得了相同的经验。

Here is what I have done to achieve this: 这是我为实现这一目标所做的工作:

  1. Service app created and worker code independantly tested. 创建了服务应用,并独立测试了工作人员代码。 I know the service does actually work once started. 我知道该服务在启动后确实可以正常工作。

  2. Added installer to the project, with serviceInstaller and serviceProcessInstaller. 使用serviceInstaller和serviceProcessInstaller将安装程序添加到项目中。 ServiceInstaller start type = manual, serviceProcessInstaller account = localsystem. ServiceInstaller的启动类型=手动,serviceProcessInstaller帐户=本地系统。

  3. Added a setup project to the solution, changed its property page entries to sensible values (author etc). 在解决方案中添加了一个安装项目,将其属性页条目更改为合理的值(作者等)。 Added custom actions (primary output from service project) for Install action through to Uninstall action. 为安装操作到卸载操作添加了自定义操作(服务项目的主要输出)。

  4. Built the solution. 构建解决方案。

  5. Executed the msi file to install the service. 执行了msi文件以安装服务。 Error - "Cannot start service from the command line or a debugger. A Windows Service must first be installed... etc". 错误-“无法从命令行或调试器启动服务。必须首先安装Windows服务...,等等”。

  6. The service isn't visible in the Services admin tool, so it clearly hasn't been installed. 该服务在“服务”管理工具中不可见,因此显然尚未安装。 However AFAICS everything has been copied to the specified installation folder. 但是,AFAICS一切都已复制到指定的安装文件夹。

Two questions: 两个问题:

  1. I have methodically followed the msdn documentation (scattered all over the place, it must be said) but can anyone suggest what I could have missed out in setting this up, that would cause the service not to be installed? 我有条不紊地遵循了msdn文档(必须散布在各处,但必须有人说),但是没有人能建议我进行设置时会错过的地方,否则将导致该服务无法安装?

  2. Why would it nevertheless be attempting to start the service when I have explicitly set startup to manual? 当我将启动明确设置为手动时,为什么仍要尝试启动服务?

I tried manually installing the servivce using InstallUtil, but that failed too. 我尝试使用InstallUtil手动安装服务,但这也失败了。 The install log from that is: 从那里的安装日志是:

Installing assembly 'C:\Program Files (x86)\Autoscribe\Matrix Gemini LIMS\Scheduler\MatrixTaskLauncher.exe'.
Affected parameters are:
   logtoconsole = 
   assemblypath = C:\Program Files (x86)\Autoscribe\Matrix Gemini LIMS\Scheduler\MatrixTaskLauncher.exe
   logfile = C:\Program Files (x86)\Autoscribe\Matrix Gemini LIMS\Scheduler\MatrixTaskLauncher.InstallLog
Installing service MatrixTaskLauncherService...
Creating EventLog source MatrixTaskLauncherService in log Application...
Rolling back assembly 'C:\Program Files (x86)\Autoscribe\Matrix Gemini LIMS\Scheduler\MatrixTaskLauncher.exe'.
Affected parameters are:
   logtoconsole = 
   assemblypath = C:\Program Files (x86)\Autoscribe\Matrix Gemini LIMS\Scheduler\MatrixTaskLauncher.exe
   logfile = C:\Program Files (x86)\Autoscribe\Matrix Gemini LIMS\Scheduler\MatrixTaskLauncher.InstallLog
Restoring event log to previous state for source MatrixTaskLauncherService.

which doesn't illuminate much. 照亮不多。 :-( :-(

TIA TIA

Turned out to be a fault with the service application (no idea what). 原来是服务应用程序有问题(不知道是什么)。 I deleted it from the solution and created a new one, added my worker class code and hey presto, it installs the service and I can start that too. 我从解决方案中删除了它,并创建了一个新的解决方案,添加了我的worker类代码,嘿,我已经安装了服务,我也可以启动它。

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

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