1

In previous versions of .Net, there were some different methods of creating a project that could run as a console app or be installed as a service.
Things like TopShelf or other approaches like: .NET console application as Windows service

This is a nice convenience for development and later deployment. I put together a vNext console app using a similar approach to the accepted answer here: .NET console application as Windows service. The issue is that vNext runs things in a different way. If you create output, it no longer gives you an exe to install. Instead you get a nuget package and a .cmd file that will tell dnx to host your application. The command file looks like: dnx --appbase "$(dirname $0)" Microsoft.Framework.ApplicationHost My.vNext.Service $@

So my question is: Is there a way to install this thing as a Windows service given the new console application approach?

Community
  • 1
  • 1
swannee
  • 3,346
  • 2
  • 24
  • 40
  • What new console application approach? vNext refers to ASP.NET only, not the language or desktop applications. It doesn't affect how services work either. What are you trying to do? Are you confusing ASP.NET vNext's self-hosting with actual console applications? – Panagiotis Kanavos Jul 23 '15 at 16:04
  • If your question is "how can I run my self-hosted ASP.NET app as a Windows service", the answer is that you *can* create Windows Service entries for specific command lines or batches, [as shown in this question](http://stackoverflow.com/questions/415409/run-batch-file-as-a-windows-service). There is an [open ASP.NET issue on GitHub](https://github.com/aspnet/Home/issues/448) to add this functionality to ASP.NET itself but no answer yet – Panagiotis Kanavos Jul 23 '15 at 16:43
  • @PanagiotisKanavos: You can create a console app that is simply a console app that runs under dnx. There is no necessity that it be an ASP.Net application although template is bundled under "web applications" for now. In my case, I'm creating a app that runs my service bus. – swannee Jul 23 '15 at 17:17
  • Sorry, it's the first time I've heard this called "vNext". Until now, I've seend this refer exclusively to ASP.NET vNext. I've added the `.net-core` tag. Still, my "answer" still applies - you *can* create Windows Service entries that call a batch or command-line, or use a tool to do this for you. The real solution though would be cross-platform support for services/daemons in .NET Core. – Panagiotis Kanavos Jul 24 '15 at 07:27
  • @PanagiotisKanavos : Cool thanks for the response. – swannee Jul 24 '15 at 13:36
  • I haven't tried to run as service but you should be able to do it. If your service runs as a different user then you might have to `dnu publish` it first because, otherwise, it will try to load the runtime from the user profile's. – Victor Hurdugaci Jul 24 '15 at 16:04

0 Answers0