简体   繁体   English

不使用installutil从控制台应用程序安装服务

[英]Install service from my console app not using installutil

I have a solution I have split in 3 parts. 我有一个解决方案,我分为三个部分。

  1. a console app 控制台应用
  2. a dll 一个dll
  3. a service 服务

All the main code for my application is in the dll and the console app just calls a single method in the dll that then runs my application. 我的应用程序的所有主要代码都在dll中,而控制台应用程序仅在dll中调用一个方法,然后运行我的应用程序。

I designed it in this way hoping to make it easy for myself to test the code not having to install the service over and over again. 我以这种方式设计了它,希望自己可以轻松地测试代码,而不必一遍又一遍地安装服务。 So my plan is that the main method in the service which is called by the timer should call the same method in the dll. 因此,我的计划是计时器调用的服务中的主要方法应在dll中调用相同的方法。

I am missing 2 parts of code. 我缺少2部分代码。 1 for installing the service and 1 for uninstalling the service. 1用于安装服务,1用于卸载服务。 I would like to be able to do both from the console app via arguments. 我希望能够通过参数在控制台应用程序中同时执行这两项操作。

Searching for code examples for installling service I can only examples that use the installutil application which is not what I want. 搜索用于安装服务的代码示例我只能使用不想要的installutil应用程序的示例。

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

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