如何使用较新版本的 .NET 处理 Windows 服务 C#?
...
大家好,
我想用 c# 创建一个 Windows 服务。但我只能选择.NET Framework 之一:
.NET Framework 2.0
.NET Framework 3.0
.NET Framework 3.5
.NET Framework 4.7.2
.NET Framework 4.8
但我需要的是.NET 6.0
。但问题是,.NET 6.0
是否已安装完毕并且可用于控制台应用程序?我有两个版本的控制台应用程序项目。一种带有 (.NET Framework)
,一种不带有。但为什么我只有服务应用程序的 (.NET Framework)
项目?
你如何处理服务。您是否将所有应用程序代码写入服务中?您仅使用该服务来运行控制台应用程序吗?
谢谢!
...
Hi all,
I'd like to create a Windows Service in c#. But I can only choose one of the .NET Frameworks:
.NET Framework 2.0
.NET Framework 3.0
.NET Framework 3.5
.NET Framework 4.7.2
.NET Framework 4.8
But what I need is .NET 6.0
. But the Problem is, .NET 6.0
is allready installed and is usable for console-apps? I have two versions of console-app projekts. One with (.NET Framework)
and one without. But why I only have (.NET Framework)
projects for service-apps?
How do you handle services. Do you write all of you app-code into the service? Do you only use the service to run a console app?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有几个示例,但主要的是,编写一个控制台应用程序和托管服务,并在主机构建器的末尾添加 .UseWindowsService() 。
https://csharp.christiannagel.com/2019/10/15/windowsservice/< /a>
https://learn.microsoft.com/en-us/ dotnet/core/extensions/windows-service
Here are a couple of examples, but the main thing is, write a console application and with a hosted service, and add .UseWindowsService() on the end of your Host builder.
https://csharp.christiannagel.com/2019/10/15/windowsservice/
https://learn.microsoft.com/en-us/dotnet/core/extensions/windows-service