Is it possible for me to create a Windows Service

2019-07-27 02:17发布

I don't know why Visual Studio is such that there are a million different versions (Visual Studio for Desktop, Visual Studio for Web, Visual Studio Code, etc.) and each version has a different set of project templates. Anyhow, the problem I'm having is that I'm creating an ASP.NET MVC application through Visual Studio Web 2013 and I want it to be supported by a Windows Service that is started in my App_Start(). The problem of course is that when I read the instructions on https://msdn.microsoft.com/en-us/library/zt39148a(v=vs.110).aspx there is no Windows Service template on Visual C# when I try to add a new project to my solution.

1条回答
▲ chillily
2楼-- · 2019-07-27 02:56

I understand your web endpoint will be dependent on a Windows Servie, and you want to author that windows service as part of your solution.

Setting aside that VS.net 2015 Community Edition rolls up all the functionality you need. You dont need the project template specifically to create a windows service. It just automatically adds some references and templates into your project. All project templates in VS .net rely on the .net framework - and that isn't any different between one installation and another of VS.net.

In practise you can code a windows service written for .net in Notepad and just call the CSC compiler manually - the version of VS.net just adds some ease-of-use.

There is a set of instructions here https://msdn.microsoft.com/en-us/library/9k985bc9(v=vs.110).aspx from Microsoft which include specific instructions on how to make a windows service without a template.

查看更多
登录 后发表回答