简体   繁体   English

如何将控制台应用程序作为Windows服务运行? 我对MS默认提供的“ ClickOnce”文件感到困惑(VS 2008,C#)

[英]How to run a console app as a windows service? I'm getting confused by the “ClickOnce” files MS gives by default (VS 2008, C#)

This may seem a bit silly but I can't figure out where to start. 这似乎有些愚蠢,但我不知道从哪里开始。 I've found plenty of code online on how to do this, but I just don't know where to put it. 我已经在网上找到了大量有关如何执行此操作的代码,但我只是不知道将其放在何处。 I've created a console app that I'm trying to run in the background as a service (that will start when windows starts, close when windows closes etc..). 我创建了一个控制台应用程序,试图在后台作为服务运行(它将在Windows启动时启动,在Windows关闭时关闭等)。 I'm not sure what I should be doing to facilitate this though. 不过,我不确定应该采取什么措施来促进这一点。 Should I create a new project in the same solution? 我应该在相同的解决方案中创建一个新项目吗? Or a new class in the same project? 还是同一项目中有新班级? When I do create the service, how can I install it? 创建服务后,如何安装? Do I just publish it? 我只发布它吗? I've found some code online saying I should have a .exe file but all I have is ClickOnce? 我在网上找到了一些代码,说我应该有一个.exe文件,但我只有ClickOnce吗?

Thanks in advance... 提前致谢...

Have a look at 看一下

  • What says msdn about windows service 关于Windows服务的MSDN怎么说

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

相关问题 C#我对此服务例程感到困惑 - C# I"m confused with this service routine 运行 C# clickonce 控制台应用程序 - Running C# clickonce console app windows 服务和更新 c# 控制台应用程序 - windows service & updating c# console app 如何创建 C# windows 服务应用程序以在针对单个文件夹检查新文件的多个服务器上运行 - How to create C# windows service app to run on multiple servers targeting a single folder checking for new files 如何将控制台构建添加到 C# windows 服务应用程序并显示控制台? - How to add console build to a C# windows service app and have the console show up? 将 Windows 服务作为控制台应用程序运行 - Run a Windows Service as a console app 如何使用Visual Studio 2010将Windows控制台应用程序C#项目更改为Windows Service? - How to change Windows console app C# project into Windows Service using Visual Studio 2010? 如何在后台运行控制台应用程序[C#] - How to run console app in background [C#] 如何将在MS SQL Server 2008 R2中创建的数据库与VS C#项目一起使用? - How do I used a database I created in MS SQL Server 2008 R2 with a VS C# Project? 如何在 Windows 11 ARM64 上使用 VS Code 调试 C# 控制台应用程序? - How to debug C# console app with VS Code on Windows 11 ARM64?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM