简体   繁体   English

C#Windows服务

[英]C# windows service

I want to create a windows service, and I am not sure whether to write it on c sharp or c++. 我想创建一个Windows服务,但不确定是在c Sharp还是C ++上编写它。 I wander if you create the service in c#, do I need to have the whole .net framework installed on the client? 如果您在c#中创建服务,我会徘徊,我是否需要在客户端上安装整个.net框架? If I do it in c++, as a clr application, it will use the .net framework and it will be managed code. 如果我使用c ++作为clr应用程序来执行此操作,它将使用.net框架并将其托管代码。 Does that mean that the .net framework has to be installed in the client running the windows services? 这是否意味着必须在运行Windows服务的客户端中安装.net框架? Is the CLR installed in all pc?, i mean, if I write a .net server (c# or c++), is the clr already installed in the client, do I need to have something in mind when deplying the windows service to a client machine 是否在所有PC上都安装了CLR?我的意思是,如果我编写了.net服务器(C#或C ++),客户端中已经安装了clr,那么在将Windows服务提供给客户端时是否需要注意一些事项?机

Many thanks for your help 非常感谢您的帮助

Any code that uses .Net requires the .Net framework installed on the machine where it has to run. 使用.Net的任何代码都需要在运行它的计算机上安装.Net框架。 So, regardless of whether it's C# or C++, if you're using .Net framework, you'll need to have the framework installed. 因此,无论是C#还是C ++,如果您使用的是.Net框架,则都需要安装该框架。

.Net framework comes pre-installed with Windows Vista and Windows 7 too, I believe. 我相信.Net框架也预装了Windows Vista和Windows 7。 You can check the list of OS that have .Net framework pre-installed (anyway, it's not that big). 您可以检查已预安装.Net框架的OS列表(无论如何,它并不大)。

CLR is installed in all machines that have .Net framework, because CLR is part of .Net framework. 因为CLR是.Net框架的一部分,所以CLR安装在所有具有.Net框架的计算机上。

So, if you're installing a .Net-based Windows Service, here are your checkpoints : 因此,如果要安装基于.Net的Windows服务, 请检查以下几点
Check if the system has .Net Framework (that is compatible with your service). 检查系统是否具有.Net Framework(与您的服务兼容)。
If not, then install the .Net Framework first. 如果没有,请先安装.Net Framework。
Else, go ahead and install the service. 否则,继续安装该服务。 Start it and you're good. 启动它,您就很好。

Managed C++ requires the .NET framework to be installed on the client's machine, as does an application written in C#. 托管C ++和使用C#编写的应用程序一样,要求在客户端计算机上安装.NET框架。

The .NET Framework is installed on Windows Vista, and Windows 7 (2.0 and 3.0 respectively) however can be removed by the user. .NET Framework已安装在Windows Vista和Windows 7(分别为2.0和3.0)上,但是可以由用户删除。

It is best to check if they've got it installed and allow them to download/install it as part of your application's installation process. 最好检查他们是否已安装它,并允许他们在应用程序安装过程中下载/安装它。

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

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