繁体   English   中英

安装Windows服务-Setup.exe失败

[英]Installing a Windows Service -Setup.exe fails

我面临一个奇怪的问题。 我通过浏览各种博客和教程创建了我的第一个Windows服务。 然后为添加的安装程序等创建安装程序。它在通过Visual Studio安装和卸载时工作正常,但在我部署它时失败。

Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of C:\Users\bhuvint\Documents\Visual Studio 2010\Projects\CPNS Library\ServicePackage\CommonPushNotificationWindowsService.application resulted in exception. Following failure messages were detected:
        + You cannot start application CommonPushNotificationWindowsService from this location because it is already installed from a different location.
        + You cannot start application CommonPushNotificationWindowsService from location file:///C:/Users/bhuvint/Documents/Visual%20Studio%202010/Projects/CPNS%20Library/ServicePackage/CommonPushNotificationWindowsService.application it is already installed from location file:///C:/inetpub/wwwroot/ServicePackage/CommonPushNotificationWindowsService.application. You can start it from location file:///C:/inetpub/wwwroot/ServicePackage/CommonPushNotificationWindowsService.application or you can uninstall it and reinstall it from location file:///C:/Users/bhuvint/Documents/Visual%20Studio%202010/Projects/CPNS%20Library/ServicePackage/CommonPushNotificationWindowsService.application.

我已经卸载了该服务,并尝试从同一台PC中已部署的服务中进行安装以进行测试。 但是它失败并出现以上错误。 我觉得我以错误的方式部署了Windows服务。 你们可以建议如何部署Windows服务吗? (我浏览过网络。所有人都建议从视觉工作室构建并安装它。但是如何发布它是我所需要的。)

请尽快帮助。

可能是在卸载先前的服务之前构建了安装项目。 在这种情况下,您将无法使用新的安装程序来卸载服务,因为安装程序将是不同的,并且将无法访问已安装的服务。

您应该尝试使用项目的先前版本并卸载该服务,以备将来每次构建安装项目时取消安装该服务。

这发生在我身上好几次了。

在调试模式下运行Visual Studio,然后在服务项目的属性中,在构建后事件命令行中转到选项卡构建事件并添加-d,以便无需安装即可运行服务,它将作为控制台应用程序运行

LocalService帐户充当本地计算机上的非特权用户,并向任何远程服务器提供匿名凭据。 请谨慎使用其他帐户,因为它们以更高的特权运行,并增加了遭受恶意代码攻击的风险。

如果您的服务应用程序无法正确安装,请检查以确保服务类的ServiceName属性设置为与该服务的安装程序中显示的值相同。 在两个实例中,该值必须相同,以便正确安装服务。 注意注意

您也可以查看安装日志以获取有关安装过程的反馈。

您还应该检查以确定是否已经安装了具有相同名称的其他服务。 服务名称必须唯一,才能成功安装。

愚蠢的人

正如我告诉我的那样,我正在部署我的服务。 因此,此发布的代码具有一个“ setup.exe”文件。 现在,我已经为Windows服务创建了一个安装项目,该服务用于安装,卸载。 而且我不知道(这些词需要勇气!!)安装Windows服务需要创建的msi文件。 因此,当我完成安装项目的文件夹结构时。 我遇到了.msi文件。 因此问题得以解决。 主要问题是:

  • 我不知道要使用安装项目
  • 我将setup.exe与已发布的Windows服务与Windows服务的安装程序混淆了。

对于您从宝贵的时间中窃取带宽感到非常抱歉。 感谢所有人的宝贵意见。

暂无
暂无

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

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